Hmm, I should probably point out a few things with those links

<item value="admin.menu"
               link="admin"
               tooltip="admin.title"
               classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />


The value is normally the text to link on, but I have internationalised my app so I use it as the key to look up the real name in my application.properties file.


<bean:message key="${crumb.value}" />

Same goes for the tooltip, it is just the name of the key to look up.

The link I use is just the name of a forward. And I am using JSTL to substitute the values into the struts html-el tags (i only use html-el so I just labelled mine html instead of html-el) eg

<html:link forward="${crumb.link}" titleKey="${crumb.tooltip}">


So my breadcrumbs can appear in japanese or english depending on the locale that is selected.
These breadcrumbs work if you have 1 path to the page. If you want to track history you will have to do something else.



Jason Lea wrote:


Andy Engle wrote:



Hi all,

Is there any slick way of putting breadcrumbs into a web app with
Struts?  If so, what's the preferred way?

Thanks.


Andy



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]







I did this using tiles. I have my tiles extending a base layout, then each sub-menu item extends the parent tile definition
eg
(first level)
<definition name=".main.admin" extends=".layout">
...
</definition>


(second level)
<definition name=".main.admin.workflow.list" extends=".main.admin">
 ...
</definition>

Now, for breadcrumbs I would define breadcrumb0 in the first level. As the second level extends the first, breadcrumb0 will be included. In the second level I define breadcrumb1

eg
<definition name=".main.admin" extends=".layout">
       <put name="title"  value="admin.title" />
       <put name="body"  value="/WEB-INF/jsp/tiles/admin/admin.jsp" />
       <putList name="breadcrumb0" >
           <item value="admin.menu"
               link="admin"
               tooltip="admin.title"
               classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
       </putList>
   </definition>

<definition name=".main.admin.workflow.list" extends=".main.admin">
<put name="title" value="workflow.list.title" />
<put name="body" value="/WEB-INF/jsp/tiles/admin/workflow/list.jsp" />
<putList name="breadcrumb1" >
<item value="workflow.menu"
link="workflowlist"
tooltip="workflow.title"
classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
</putList> </definition>


I had originally wanted to just to be able to add an item to the breadcrumb list, but that is not possible in xml. In my layout.jsp page I then use

<tiles:useAttribute name="breadcrumb0" ignore="true" />
<tiles:useAttribute name="breadcrumb1" ignore="true" />
<tiles:useAttribute name="breadcrumb2" ignore="true" />

<!-- breadcrumbs -->
<div class="breadcrumbs">
<span class="breadcrumb mainnavitem"><html:link forward="homepage" titleKey="homepage.title"><bean:message key="homepage.menu" /></html:link></span>
</c:forEach>


<c:forEach items="${breadcrumb0}" var="crumb">
<span class="breadcrumb mainnavitem"><bean:message key="breadcrumb.separator" /> <html:link forward="${crumb.link}" titleKey="${crumb.tooltip}"><bean:message key="${crumb.value}" /></html:link></span>
</c:forEach>


<c:forEach items="${breadcrumb1}" var="crumb">
<span class="breadcrumb mainnavitem"><bean:message key="breadcrumb.separator" /> <html:link forward="${crumb.link}" titleKey="${crumb.tooltip}"><bean:message key="${crumb.value}" /></html:link></span>
</c:forEach>


<c:forEach items="${breadcrumb2}" var="crumb">
<span class="breadcrumb mainnavitem"><bean:message key="breadcrumb.separator" /> <html:link forward="${crumb.link}" titleKey="${crumb.tooltip}"><bean:message key="${crumb.value}" /></html:link></span>
</c:forEach>
</div>
<!-- end breadcrumbs -->


Hope that make somes sort of sense. If not ask me a question and I will try to explain better.





--
Jason Lea
Email:     [EMAIL PROTECTED]
Phone/Fax: +64  3 381 2907
Mobile:    +64 21 040 2708
ICQ:       67452939
MSN:       [EMAIL PROTECTED]
Jabber:    [EMAIL PROTECTED]
Address:   9a Tabart Street, Christchurch, New Zealand


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to