Seems to me that there's a lot of variable creation at the beginning of each
page that is never going to be used.  I know it gets compiled into Java, but
it still takes time.  I'd be afraid that if there were more than about 20
links you could be seriously slowing things down for a bit of syntactic
sugar at development time.
  (*Chris*)

On Fri, Mar 13, 2009 at 9:40 PM, dusty <dustin_pea...@yahoo.com> wrote:

>
> Sorry it took me a while.  Damn flu season...
>
> Anyways, its not really complicated but I have found it to be useful.  It
> was inspired from some RoR projects I worked on and is a poor mans routing
> table.
>
> You create a JSP that you will include at the top of all your JSP views.
>  In
> this JSP you add url tags like:
>
> <s:url id="customers_path"
>          namespace = "/customers"
>          action = "index"/>
>
> <s:url id="customer_path"
>          namespace = "/customers"
>          action = "show"/>
>
> <s:url id = "customers_new_path" ...etc, etc
>
> The naming convention and use of singular and plurals for certain names I
> lifted from Rails conventions.
>
> Then in your view JSPs where the above is included, you use a JSTL
> expresssion like:
>
> <a href="${customers_path}">Customers Index</a>
>
> Since you are globally including this you don't parameterize urls like
> "customer_path" in the routes page, but just write out the query string
> like
> you would on a normal link.
>
> <a href="${customer_path}?id=${customer.id}">Customers Index</a>
>
> (You could use <s:property/> tags but for the links I find the less verbose
> JSTL expressions to be prettier.)
>
> The other type of urls you can put in there are things like home, images,
> styles, scripts, etc.  So you can serve these static resources from
> wherever.
>
> <s:url id = "home"
>          value = "/"/>
>
> <s:url id = "images"
>          value = "/images"/>
>
> Then in the JSP its
>
> ${images}/add.png
> <link rel="stylesheet" href="${styles}/home.css"/>
> <script src="${scripts}/jquery/jquery.js"></script>
>
> So you could have something called dev-routes.jsp where the static
> resources
> are served relatively through your J2EE container and in prod-routes you
> could change it to serve from a separate Apache server to make things
> fasterish:
>
> <s:url id="images"
>          value="http://mystatic1.site.com/images/"/>
>
> I have been using this pattern on the last 3 or 4 projects and it has
> really
> stuck without much changes.  I suppose we could add some maven profiles and
> maven variables in there to switch values based on the selected maven build
> profile.
>
>
> mgainty wrote:
> >
> >
> > dave answered about namespace
> >
> > curious about 'routes pattern'
> >
> > thanks,
> > Martin
> > ______________________________________________
> > Disclaimer and confidentiality note
> > Everything in this e-mail and any attachments relates to the official
> > business of Sender. This transmission is of a confidential nature and
> > Sender does not endorse distribution to any party other than intended
> > recipient. Sender does not necessarily endorse content contained within
> > this transmission.
> >
> >
> >
> >
> >> Date: Thu, 12 Mar 2009 20:23:57 -0700
> >> From: dustin_pea...@yahoo.com
> >> To: user@struts.apache.org
> >> Subject: RE: this is driving me nucking futs!
> >>
> >>
> >> Sorry Martin, did Dave answer your question?  Were you just wondering
> >> about
> >> the namespace parameter on the url tag or about the routes pattern in
> >> general?
> >>
> >>
> >> mgainty wrote:
> >> >
> >> >
> >> > can you explain this routes a bit more..what is this another attribute
> >> or
> >> > a template?
> >> > i can see see action, params but namespace?
> >> >
> >> > if you look at the code the base class changes from
> >> > public class AnchorTag extends AbstractClosingTag
> >> > TO
> >> > public class AnchorTag extends ContextBean
> >> > basing AnchorTag on a bean allows you to tack on infinitely more
> >> > attributes
> >> > ...
> >> > Martin
> >> > ______________________________________________
> >> > Disclaimer and confidentiality note
> >> > Everything in this e-mail and any attachments relates to the official
> >> > business of Sender. This transmission is of a confidential nature and
> >> > Sender does not endorse distribution to any party other than intended
> >> > recipient. Sender does not necessarily endorse content contained
> within
> >> > this transmission.
> >> >
> >> >
> >> >
> >> >
> >> >> Date: Thu, 12 Mar 2009 09:24:54 -0700
> >> >> From: dustin_pea...@yahoo.com
> >> >> To: user@struts.apache.org
> >> >> Subject: Re: this is driving me nucking futs!
> >> >>
> >> >>
> >> >> Adding the action, namespace and params url constructing pieces to
> s:a
> >> >> would
> >> >> be cool, as long as we don't nerf the s:url function.  I rather like
> >> the
> >> >> pattern of using a central "routes" page as an include where urls are
> >> >> created and their ids referenced in links via JSTL in the main pages.
> >> >>
> >> >> -D
> >> >>
> >> >> newton.dave wrote:
> >> >> >
> >> >> > mitch gorman wrote:
> >> >> >>     I AM AN INSTRUMENT OF CHANGE!!!
> >> >> >
> >> >> > Hmm, when people say that about me they say I'm a tool.
> >> >> >
> >> >> > I'm not *entirely* sure they're being complimentary ;)
> >> >> >
> >> >> > Dave
> >> >> >
> >> >> >
> >> >> >
> >> ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> >> >> > For additional commands, e-mail: user-h...@struts.apache.org
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://www.nabble.com/this-is-driving-me-nucking-futs%21-tp22463203p22479288.html
> >> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> >> >> For additional commands, e-mail: user-h...@struts.apache.org
> >> >>
> >> >
> >> > _________________________________________________________________
> >> > Windows Live™ Groups: Create an online spot for your favorite groups
> to
> >> > meet.
> >> > http://windowslive.com/online/groups?ocid=TXT_TAGLM_WL_groups_032009
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/this-is-driving-me-nucking-futs%21-tp22463203p22489517.html
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> >> For additional commands, e-mail: user-h...@struts.apache.org
> >>
> >
> > _________________________________________________________________
> > Windows Live™ Contacts: Organize your contact list.
> >
> http://windowslive.com/connect/post/marcusatmicrosoft.spaces.live.com-Blog-cns!503D1D86EBB2B53C!2285.entry?ocid=TXT_TAGLM_WL_UGC_Contacts_032009<http://windowslive.com/connect/post/marcusatmicrosoft.spaces.live.com-Blog-cns%21503D1D86EBB2B53C%212285.entry?ocid=TXT_TAGLM_WL_UGC_Contacts_032009>
> >
>
> --
> View this message in context:
> http://www.nabble.com/this-is-driving-me-nucking-futs%21-tp22463203p22509369.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to