MG>comments? ______________________________________________ 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.
> > > Sorry it took me a while. Damn flu season... MG>we're ALL waiting for nationalised health insurance! > > 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. MG>i compiled a RoR one time ..havent been able to get the module-ror compiled since MG>i think the project was abandoned as I have'nt been able to get ahold of maven scripts MG>to create the module properly.. > > 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"/> MG> i assuming <s:url id="customer_paths" instead of duplicating custome_path? MG>change url2 namespace from customers to customer? > <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> MG>anchor href uses prebuilt urls is already implemented in showcase.jsp (v2.1.6) MG><li><a href="<s:url action="actionChain1!input" namespace="/actionchaining" MG>includeParams="none" />">Action Chaining</a></li> > > 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> MG>then in the the case where <-- Example 2 --> <s:url action="editGadget"> <s:param name="id" value="%{#parameters.search['id'}" /> <s:url action="edit" includeParams="get"> <s:param name="id" value="%{'22'}" /> </s:url> the value 22 will be assigned over any customer.id as the includeParams="get" takes precedence http://struts.apache.org/2.x/docs/url.html How would you handle the scenario of assignment precedence for includeParams? MG> > (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 MG>J2EE container serving faster than Apache? >and in prod-routes you > could change it to serve from a separate Apache server MG>Apache http-server serves static resources faster than any J2EE compliant container > 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. MG>are you voluntering to create a maven archetype for this? MG>anyone else? MG>thanks for the info..this has been helpful MG> > > 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 > > > > -- > 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 > _________________________________________________________________ Windows Live™: Life without walls. http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_032009