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



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



Reply via email to