struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject Re: preserve Forward order
Date Sun, 22 Sep 2002 02:34:44 GMT
Billy,

Just out of curiosity, why would you provide direct links for the paths
of a mapping's local forwards? I can imagine a couple of scenarios where
it might be useful to generate links for the paths of each mapping, but
I don't get doing that for local forwards. If you link directly to a
local forward, you effectively bypass the action that would normally
operate on the request before doing a forward or redirect to that
forward's path. Maybe I'm missing something, but I'm not sure the links
will operate the way you're expecting.

Billy Ng wrote:
> 
> I knew somebody would ask me why :-)
> 
> Okay, I am using the String[] that returns from mapping.findForwards() to
> generate links in the left nav bar.  This way, I will only generate the
> links for the Action I call.  For example,
> 
>   <action path="/project"
>           type="com.evebill.billyng.ui.about_me.AboutMeBase"
>           name="AboutMeAction">
>    <forward name="bridge" path="/jsp/about_me/bridge.jsp"/>
>    <forward name="subway" path="/jsp/about_me/subway.jsp"/>
>    <forward name="library" path="/jsp/about_me/library.jsp"/>
>   </action>
> 
> String[] forwards = mapping.findForwards();
> for (int i=0; i< forwards.length; i++) {
>   ActionForward forward = mapping,findForward(forwards[i]);
>   out.print("<A href=\""+forward.getPath()+"\">"+forward.getName()+"</A>";
> }
> 
> I know I am lazy, but it works very good except the sorting.  That's why I
> want the elements of the String[] has the order I put in struts-conf.xml
> 
> Billy Ng
> 
> ----- Original Message -----
> From: "Eddie Bush" <ekbush@swbell.net>
> To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
> Sent: Saturday, September 21, 2002 8:23 AM
> Subject: Re: preserve Forward order
> 
> > I'm not sure what you're trying to do.  Most generally, folks use
> > 'mapping.findForward( "success")' -- or something very close to it.
> >  That returns the forward in question.  Why do you need the whole list?
> >
> > Billy Ng wrote:
> >
> > >When I use mapping.findForwards(), it returns me the sorted forward
> names.  How can I get the forward names in the same order as in the
> struts-conf.xml?
> > >
> > >Thanks!
> > >
> > >Billy Ng
> > >
> >
> > --
> > Eddie Bush
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> >

-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>
Mime
View raw message