Just getting caught up w/ the list, but another option to explore is to use a custom taglib, in our case, we had documents located under a folder tree, and wanted a breadcrumb back up to the top of the folder tree, so what I did was write a custom tag that looked like this:
<foo:writeBreadcrumb docId="200" (optional)styleId="cssIdName" (optional)useLinks="false"/> With some back-end code to determine the folder-tree path and writes out the entire breadcrumb string. It also accepts a optional style argument that I can pass in if I want to use a different CSS style for the breadcrumb. The useLinks argument is whether HTML links should be generated for each 'node' of the breadcrumb or not. I would imagine somehting similar w/ different taglib implementation could be used to maintain a stack of previously visited links in session memory or something for a user, if you wanted to provide a historical trail instead of a folder-tree trail. I've found this approach to be very clean JSP-wise, and lets me swap out different implementations if a more effective one is found, etc.. Furthermore, an additonal argument could be added if one wanted to modify the dividers, like if to use carrot-top arrows, or a pipe symbol, or whatever for true separation of logic/HTML concerns, but we haven't needed to do that yet. Just my two cents. -tim -----Original Message----- From: Miller, Judd M,,DMDCWEST [mailto:[EMAIL PROTECTED] Sent: Monday, February 23, 2004 7:57 PM To: 'Struts Users Mailing List' Subject: RE: Breadcrumbs Cool, thanks Jason. ---Judd -----Original Message----- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Monday, February 23, 2004 2:28 PM To: Struts Users Mailing List Subject: Re: Breadcrumbs 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

