struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <George.Dinwid...@wellsfargo.com>
Subject RE: Handling breadcrumbs with Struts
Date Thu, 21 Sep 2006 16:36:56 GMT
Creating a working sample would be quite a bit of work, and I don't have time at the moment.
 In a nutshell, I would have a bean something like:

public class Breadcrumb {
	public String getName() {...}
	public String getUrl() {...}
}

The BreadcrumbTileController would do something like

	List breadcrumbList = getBreadcrumbsFromSession(request);
	Breadcrumb breadcrumb = makeBreadcrumbFromRequest(request);
	breadcrumbList.add(breadcrumb);
	request.setAttribute("breadcrumbslist", breadcrumbList);

The BreadcrumbTile.jsp might contain something like

	<c:forEach items="${breadcrumbslist}" var="breadcrumb">
		<html:link href="${breadcrumb.url}><c:out value="${breadcrumb.name}" /></html:link>
	</c:forEach>

The tile definition would associate the controller with the tile:

	<definition name="BreadcrumbTile"
		path="/WEB-INF/tiles/BreadcrumbTile.jsp" 
		controllerClass="my.domain.breadcrumbs.BreadcrumbTileController ">
	</definition>

Then define your default page layout to include the BreadcrumbTile.

A thousand variations are possible, depending on the context of your application.  Adjust
to suit.

 - George Dinwiddie
   http://www.idiacomputing.com/

> -----Original Message-----
> From: Marcello Savino [mailto:Marcello.Savino@aldebra.com] 
> Sent: Thursday, September 21, 2006 3:04 AM
> To: Struts Users Mailing List
> Subject: R: Handling breadcrumbs with Struts
> 
> 
> Could you post a little sample ?
> 
> -----Messaggio originale-----
> Da: George.Dinwiddie@wellsfargo.com 
> [mailto:George.Dinwiddie@wellsfargo.com] 
> Inviato: mercoledì 20 settembre 2006 20.59
> A: user@struts.apache.org
> Oggetto: RE: Handling breadcrumbs with Struts
> 
> I would use a tile.  The tile controller can retrieve 
> information from the request and add it to a list kept in 
> session scope.  The tile, itself, can display that list as 
> breadcrumbs.
> 
> > -----Original Message-----
> > From: Darren Hall [mailto:dhall@utrs.com]
> > Sent: Wednesday, September 20, 2006 12:24 PM
> > To: 'Struts Users Mailing List'
> > Subject: Handling breadcrumbs with Struts
> > 
> > 
> > My lack of Struts knowledge is showing here, but -
> > 
> > I need to move data from my action object to my jsp through
> > some sort of value object (probably a bean). For example, my 
> > web application will use breadcrumbs at the top of the body 
> > of nearly every page. This information will need to be 
> > updated on every request. I need to find a way to pass this 
> > information back and forth on each request. Does struts 
> > provide any built in mechanism for this (maybe though the 
> > Bean taglib) or is there a "preferred" way to handle my 
> > breadcrumbs through Struts?
> > 
> >  
> > 
> > Thanks
> > 
> > Darren
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message