You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mitch gorman <mg...@shadowtv.biz> on 2009/03/11 20:58:30 UTC

this is driving me nucking futs!

    okay, can anyone (musachy, david, martin, i'm looking in your
direction!) tell me how to do what i'm trying to do, here?

    i've got a list of items i'm iterating over.  for each item, i want
to have one or more links to actions, with parameterization from the
item's data.  this means, using a unique value for each <s:url> tag's id
attribute.  the trouble comes in trying to reference the unique id value
in my <s:a> tag.

    a trivial example will demonstrate my quandary more clearly:

<s:iterator value="listItems" status="rowstatus">
    <s:push value="#rowstatus">           <%-- done to make actual code a
                                            little cleaner to read; this
example
                                            doesn't really need it --%>

        <%-- the following correctly puts "link-1", "link-2", etc, into
the stack context --%>
        <s:url id="link-%{count}" namespace="/" action="linkAction">
          <s:param name="count" value="%{count}" />      <%-- purely for
the example --%>
        </s:url>

        <s:a href="WHAT GOES HERE??!?">
            Link #<s:property value="%{count}" />
        </s:a>
    </s:push>
</s:iterator>

    how can i get the proper "#link-<count value>" into that href field
in my JSP, to be dereferenced by struts (in the resulting html sent to
the browser) into the actual URL assembled specifically for that item? 
i've tried dozens of syntactical constructions, none of which worked. 
the closest i ever got was to see URLs that looked like
"http://my.com/linkAction.do?link-2"... just couldn't get that "link-2"
string to be properly parsed by struts as an "argument" to the "#"... 
i've tried various combinations with <s:push> and <s:set>, but
ultimately, i come down to needing something like "%{#( ...%{#...})}"
...and that definitely doesn't fly!

    any thoughts on how to accomplish this?  i can't believe i'm the
first person to ever want to do something like this...
      

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


Re: this is driving me nucking futs!

Posted by mitch gorman <mg...@shadowtv.biz>.
Wes Wannemacher wrote:
> It seems like you are created a variable variable name... I am
> assuming that there is a reason why you are using <s:a /> and wanting
> to refer to the constructed URL by id, rather than just doing the
> following -
>
> <a href="<s:url namespace="/" action="linkAction">
>          <s:param name="count" value="%{count}" />
>        </s:url>">blah</a>
>
> In an iterator, rather than constructing a name and trying to use OGNL
> to unravel that name, I'd just construct the URL in a plain ol' <a />
> tag.
>   

    readability.  i think the above is tougher to maintain than using a
reference to a <s:url> tag, especially when you consider that that was a
trivial example... there may be multiple params, and some of the values
to be passed may, themselves, be somewhat convoluted.
would it work?  sure...  i was just hoping for something a little more
slick and concise.

    as musachy pointed out, it may be that i'm overcomplicating, and i'm
going to test that out straight away... 


    thanks!

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


Re: this is driving me nucking futs!

Posted by Wes Wannemacher <we...@wantii.com>.
It seems like you are created a variable variable name... I am
assuming that there is a reason why you are using <s:a /> and wanting
to refer to the constructed URL by id, rather than just doing the
following -

<a href="<s:url namespace="/" action="linkAction">
         <s:param name="count" value="%{count}" />
       </s:url>">blah</a>

In an iterator, rather than constructing a name and trying to use OGNL
to unravel that name, I'd just construct the URL in a plain ol' <a />
tag.

-Wes


On Wed, Mar 11, 2009 at 4:21 PM, mitch gorman <mg...@shadowtv.biz> wrote:
> mitch gorman wrote:
>>     okay, can anyone (musachy, david, martin, i'm looking in your
>> direction!) tell me how to do what i'm trying to do, here?
>>
>>     i've got a list of items i'm iterating over.  for each item, i want
>> to have one or more links to actions, with parameterization from the
>> item's data.  this means, using a unique value for each <s:url> tag's id
>> attribute.  the trouble comes in trying to reference the unique id value
>> in my <s:a> tag.
>>
>
>    forgot to mention, v2.0.14.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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


Re: this is driving me nucking futs!

Posted by mitch gorman <mg...@shadowtv.biz>.
mitch gorman wrote:
>     okay, can anyone (musachy, david, martin, i'm looking in your
> direction!) tell me how to do what i'm trying to do, here?
>
>     i've got a list of items i'm iterating over.  for each item, i want
> to have one or more links to actions, with parameterization from the
> item's data.  this means, using a unique value for each <s:url> tag's id
> attribute.  the trouble comes in trying to reference the unique id value
> in my <s:a> tag.
>   

    forgot to mention, v2.0.14.


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


Re: this is driving me nucking futs!

Posted by mitch gorman <mg...@shadowtv.biz>.
Musachy Barroso wrote:
> yeah, the for loop is just to illustrate the point. The #context
> thingie will work in any version
       okay, well, as i just noted in my response to wes, i clearly
must've boneheaded something else when i tried it the first time,
because the simple, un-overthought approach,

<s:url id="myurl" ...
<s:a href="%{#myurl}" ...

    worked perfectly.  for some reason, i came to believe that i
*needed* to see each individual reference in the context, after the
s:iterate completed its work, but so long as the s:url's id is "unique"
to each iteration, that works just fine.  *and* makes my code even that
much more readable/maintainable!

    thanks very much, musachy!


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


Re: this is driving me nucking futs!

Posted by Musachy Barroso <mu...@gmail.com>.
yeah, the for loop is just to illustrate the point. The #context
thingie will work in any version.

On Wed, Mar 11, 2009 at 4:39 PM, mitch gorman <mg...@shadowtv.biz> wrote:
> Musachy Barroso wrote:
>> Ok, first, you don't need to define variable for each url, you can just do
>>
>> <s:url id="myurl" ..
>> <s:a href="%{#myurl}" ...
>>
>    this was the very first thing i attempted... it was the logical
> first attempt.  unfortunately, what i ended up with when i did that was
> a set of links to the last loop iteration's URL.  now, granted, i hadn't
> been using struts very long at that point, so maybe i'd screwed
> something else up.  i can certainly try this again...
>
>> inside the iterator, that will make your life easier. Assuming the
>> code was just an example, and you *really* need to create a bunch of
>> URLs and then use them, you can do it like this:
>>
>>  <s:iterator var="i" begin="0" end="10">
>>         <s:url id="link%{#i}" value="/something/%{#i}" />
>>  </s:iterator>
>>
>>  <s:iterator var="i" begin="0" end="10">
>>       <s:a href="%{#context['link'+ #i]}">somelink</s:a>
>>  </s:iterator
>    well, i can't do that exactly, since i'm using v2.0.14 (no "begin",
> "end" attributes).  however,
>
> "%{#context['link'+ #i]}"
>
>    is intriguing.  would such a construct work in v2.0.14?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: this is driving me nucking futs!

Posted by Musachy Barroso <mu...@gmail.com>.
my list of annoyances:

1. iterator tag no having "begin" and "end"
2. "a" not able to build a url
3. "validateAnnotatedMethodOnly" in "validation" interceptor should be
"true" by default

first one is down, I gotta tackle the other 2.

musachy

On Wed, Mar 11, 2009 at 5:32 PM, Jim Kiley <jh...@summa-tech.com> wrote:
> Musachy, I would refer to you as "a cool dude" if you did that.
> jk
>
> On Wed, Mar 11, 2009 at 5:10 PM, Musachy Barroso <mu...@gmail.com> wrote:
>
>> That is something I have complained about for a long time, time to do
>> something about it I guess.
>>
>> musachy
>>
>> On Wed, Mar 11, 2009 at 5:08 PM, Chris Pratt <th...@gmail.com>
>> wrote:
>> > I guess one question I would ask is why <s:a> doesn't have an action
>> > paramter and allow nested <s:param> elements?  That way there would be no
>> > need to create any variables.
>> >  (*Chris*)
>> >
>> > On Wed, Mar 11, 2009 at 1:56 PM, mitch gorman <mg...@shadowtv.biz>
>> wrote:
>> >
>> >> Wes Wannemacher wrote:
>> >> > On Wed, Mar 11, 2009 at 4:47 PM, mitch gorman <mg...@shadowtv.biz>
>> >> wrote:
>> >> >
>> >> >>    thanks for your responses, wes!
>> >> >>
>> >> >>
>> >> >
>> >> > No problem, next time, include me in your list of gurus and I'll be
>> happy
>> >>
>> >>     lol!  you got it!
>> >>
>> >>    (i knew for sure i was probably inadvertently dissing at least a
>> >> couple people here... my apologies to any *other* deserving souls!)
>> >>
>> >
>>
>>
>>
>> --
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> --
> Jim Kiley
> Senior Technical Consultant | Summa
> [p] 412.258.3346
> http://www.summa-tech.com
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: this is driving me nucking futs!

Posted by Jim Kiley <jh...@summa-tech.com>.
Musachy, I would refer to you as "a cool dude" if you did that.
jk

On Wed, Mar 11, 2009 at 5:10 PM, Musachy Barroso <mu...@gmail.com> wrote:

> That is something I have complained about for a long time, time to do
> something about it I guess.
>
> musachy
>
> On Wed, Mar 11, 2009 at 5:08 PM, Chris Pratt <th...@gmail.com>
> wrote:
> > I guess one question I would ask is why <s:a> doesn't have an action
> > paramter and allow nested <s:param> elements?  That way there would be no
> > need to create any variables.
> >  (*Chris*)
> >
> > On Wed, Mar 11, 2009 at 1:56 PM, mitch gorman <mg...@shadowtv.biz>
> wrote:
> >
> >> Wes Wannemacher wrote:
> >> > On Wed, Mar 11, 2009 at 4:47 PM, mitch gorman <mg...@shadowtv.biz>
> >> wrote:
> >> >
> >> >>    thanks for your responses, wes!
> >> >>
> >> >>
> >> >
> >> > No problem, next time, include me in your list of gurus and I'll be
> happy
> >>
> >>     lol!  you got it!
> >>
> >>    (i knew for sure i was probably inadvertently dissing at least a
> >> couple people here... my apologies to any *other* deserving souls!)
> >>
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Jim Kiley
Senior Technical Consultant | Summa
[p] 412.258.3346
http://www.summa-tech.com

Re: this is driving me nucking futs!

Posted by Musachy Barroso <mu...@gmail.com>.
it is up in svn, ticket:

https://issues.apache.org/struts/browse/WW-3037

The "a" tag now supports all the attributes that "url" supports,
except "var", which it doesn't need. It also supports nested params.
One annoyance down, a few to go.

musachy

On Thu, Mar 12, 2009 at 1:30 PM, Musachy Barroso <mu...@gmail.com> wrote:
> "a" will support all the attributes that "url" does, it is almost
> done, working on the tests at the moment.
>
> musachy
>
> On Thu, Mar 12, 2009 at 12:24 PM, dusty <du...@yahoo.com> wrote:
>>
>> 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-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: this is driving me nucking futs!

Posted by Musachy Barroso <mu...@gmail.com>.
"a" will support all the attributes that "url" does, it is almost
done, working on the tests at the moment.

musachy

On Thu, Mar 12, 2009 at 12:24 PM, dusty <du...@yahoo.com> wrote:
>
> 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-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: this is driving me nucking futs!

Posted by Chris Pratt <th...@gmail.com>.
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 <du...@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_pearce@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_pearce@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-unsubscribe@struts.apache.org
> >> >> > For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> >> >> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

RE: this is driving me nucking futs!

Posted by dusty <du...@yahoo.com>.
Yes, I remember talking to Don about it at last year's Java Symposium.  The
only exception is that RoR routes allow nested resources and provides not
only controller/action mapping but also outbound link generation.  

To tell you the truth, I am big believer in the RESTful design concept for
organizing your thoughts and code, but I am a bit skeptical of the RESTful
"automation" implementations.  A lot of attention has been paid to the
format of URLs and the ability of a framework to impute "glue" mappings
based on developers naming conventions.  

For me, the power of REST is in the clarity and consistency of design.  I am
not sure I will ever really need something to serve HTML, or JSON  or XML. 
Usually is one of the three and I control/craft that API carefully.  So I am
just using normal Stuts urls for Actions that are designed RESTfully.  I
converted in hibernate to annoations, and then in Spring and I think I am
now starting to feel more comfortable with the convention annotations for
Struts.  Before I start pumping apps out with a given pattern I have to have
a good sense of the momentum and mind share behind the code base.


mgainty wrote:
> 
> 
> //we're interested in RESTActionMapper's mapping .. the code reads as
> follows
> 
> / *   This mapper supports the following parameters:
> <code>struts.mapper.idParameterName</code> - If set, this value will be
> the name
>  *       of the parameter under which the id is stored.  The id will then
> be removed
>  *       from the action name.  Whether or not the method is specified,
> the mapper will 
>  *       try to truncate the identifier from the url and store it as a
> parameter.
> */
> 
> <code>struts.mapper.indexMethodName</code> - The method name to call for a 
> GET request with no id parameter. Defaults to 'index'.
> <code>struts.mapper.getMethodName</code> - The method name to call for a
> GET request with an id parameter. Defaults to 'show'.
> <code>struts.mapper.postMethodName</code> - The method name to call for a
> POST  request with no id parameter. Defaults to 'create'.
> <code>struts.mapper.putMethodName</code> - The method name to call for a
> PUT
>  *       request with an id parameter. Defaults to 'update'.
> <code>struts.mapper.deleteMethodName</code> - The method name to call for
> a DELETE request with an id parameter. Defaults to 'destroy'.
> <code>struts.mapper.editMethodName</code> - The method name to call for a
> GET
>  *       request with an id parameter and the 'edit' view specified.
> Defaults to 'edit'.
> <code>struts.mapper.newMethodName</code> - The method name to call for a
> GET
>  *       request with no id parameter and the 'new' view specified.
> Defaults to 'editNew'.
> 
> //to circumvent REST mapping you can simply assign  "name!method"
> convention.
>         String name = mapping.getName();
>         int exclamation = name.lastIndexOf("!");
>         if (exclamation != -1) {
>             mapping.setName(name.substring(0, exclamation)); //name=name
>             mapping.setMethod(name.substring(exclamation + 1));
> //method=method
>         }
> 
> //HERE are your ROR Rest-style mappings:
> 
> //GET customers_path becomes /customers_path method=index 
> //reason: GET request with no id default method name is 'index'
> 
> //GET customer_path/1 becomes /customers_path method="show" id=1 
> //reason: GET request with id defaults to method show with id assigned 1
> 
> //GET /customers/new becomes /customers method='editNew'
> //reason: The method name to call for a GET request with no id parameter
> and the //'new' view specified. Defaults to 'editNew'.
> 
> //POST /customers becomes /customers method='create'
> //reason: POST with no id method defaults to method create
> 
> //GET /customers/1;edit becomes /customers method='edit' id=1
> //reason: GET request with edit view specified ..defaults to edit method
> 
> //PUT /customers/1 = customers method="update" id="Thrillers"
> 
> //reason: PUT with an id (1) method defaults to update method
> 
> 
> //DELETE /customers/1 = customers method="destroy" id="1"
> //reason PUT with an id method defaults to destroy
> 
> mr don writes in the notes:
> /* This Restful action mapper enforces Ruby-On-Rails Rest-style mappings. 
> If the method 
>  * is not specified (via '!' or 'method:' prefix), the method is "guessed"
> at using 
>  * ReST-style conventions that examine the URL and the HTTP method. 
> Special care has
>  * been given to ensure this mapper works correctly with the codebehind
> plugin so that
>  * XML configuration is unnecessary.
> */
> 
> Does this conform to your understanding of ROR REST-style mappings?
> 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: Sat, 14 Mar 2009 21:43:54 -0700
>> From: dustin_pearce@yahoo.com
>> To: user@struts.apache.org
>> Subject: RE: this is driving me nucking futs!
>> 
>> 
>> @Chris - Those are definitely good points.  I think that our first
>> priorities
>> for the applications we build for the Health System are maintainability &
>> readability.  We don't have the performance needs of a major public
>> internet
>> site.  Our sites are pretty zippy. ;-)  Usually we have more large
>> dataset
>> related issues than throughput.    I suppose in a major system you could
>> subdivide your routes into different includes for different modules.  I
>> think if I was having performance issues, I would look a few other places
>> first before I look before reducing the number of variables.
>> 
>> @MG - maven scripts for Ruby on Rails?  Am I missing something?  JRuby
>> perhaps?  but its a struts forum, so we can move on... ;-)
>> 
>> In the example there is one namespace with all the RESTful actions
>> associated with a Customer (index, show, new, create, edit, update,
>> destroy).  When creating the links, the ids change plurality based on
>> conventions I have seen:
>> 
>> //GET /customers/index = customers_path
>> //GET /customers/show?id=1 = customer_path
>> //GET /customers/new = customers_new_path
>> //POST /customers/create = customers_create_path
>> //GET /customers/edit?id=1 = customer_edit_path
>> //POST /customers/update = customer_update_path
>> //POST /customers/destroy?id=1 = customer_destroy_path
>> 
>> You can place your <s:url/> inline for the anchor's href attribute.  I
>> think
>> my intent was to abstract the view page from the action's implementation
>> which allows me to update the namespace or action without a big search
>> and
>> replace.   With refactor tools these types of updates are pretty trivial. 
>> IMO, the url "reads" better with the JSTL variable reference.
> @MG yes JSTL is easier to read than OGNL 
> 
>> On precedence, the short answer is I don't.  I set includeParams default
>> globally to false and just deal with query strings, "the old way".   Its
>> just my preference, but I like to see the querystring params on each link
>> rather than just the unique additions on top of the existing GET params. 
>> I
>> think my general habits keep the querystrings fairly light, but in a
>> situation where you need a big complex querystring that you are chaining
>> you
>> can always put in an "exception" and do it however you want for that
>> case.
>> 
>> I have not built anything that needed a performance boost from offloading
>> static resource loading from another server.  I have read that this is a
>> common technique used to gain some perceived performance gain on the
>> browser
>> side.  
>> 
>> On the maven archetype, I wish I wasn't so lazy.  I still need to create
>> an
>> archetype for the template we are using for our apps.  We stripped
>> Appfuse
>> and retooled it with some better unit test classes and integrated it with
>> SSO (Crowd) and we just need to get it all wrapped up.  I really need to
>> create a template folder for Musachy's StrutsOn so I can use Groovy to
>> generate all the Dao/Managers/Controllers/Views for basic CRUD based on
>> models.    Maybe one night I can put down Left4Dead and get some work
>> done
>> instead....
>> 
>> 
>> mgainty wrote:
>> > 
>> > 
>> > 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:
>> >> 
>> >> &lt;a href="${customers_path}">Customers Index&lt;/a>
>> > MG>anchor href uses prebuilt urls is already implemented in
>> showcase.jsp
>> > (v2.1.6)
>> > MG><li> <s:url action= includeParams="none" />">Action Chaining </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.
>> >> 
>> >> &lt;a href="${customer_path}?id=${customer.id}">Customers Index&lt;/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_pearce@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_pearce@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-unsubscribe@struts.apache.org
>> >> >> >> > For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>> >> >> >> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>> >> >> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@struts.apache.org
>> >> 
>> > 
>> > _________________________________________________________________
>> > Windows Live™: Life without walls.
>> >
>> http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_032009
>> > 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/this-is-driving-me-nucking-futs%21-tp22463203p22519872.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@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-tp22463203p22530144.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


RE: this is driving me nucking futs!

Posted by Martin Gainty <mg...@hotmail.com>.
//we're interested in RESTActionMapper's mapping .. the code reads as follows

/ *   This mapper supports the following parameters:
<code>struts.mapper.idParameterName</code> - If set, this value will be the name
 *       of the parameter under which the id is stored.  The id will then be removed
 *       from the action name.  Whether or not the method is specified, the mapper will 
 *       try to truncate the identifier from the url and store it as a parameter.
*/

<code>struts.mapper.indexMethodName</code> - The method name to call for a 
GET request with no id parameter. Defaults to 'index'.
<code>struts.mapper.getMethodName</code> - The method name to call for a GET request with an id parameter. Defaults to 'show'.
<code>struts.mapper.postMethodName</code> - The method name to call for a POST  request with no id parameter. Defaults to 'create'.
<code>struts.mapper.putMethodName</code> - The method name to call for a PUT
 *       request with an id parameter. Defaults to 'update'.
<code>struts.mapper.deleteMethodName</code> - The method name to call for a DELETE request with an id parameter. Defaults to 'destroy'.
<code>struts.mapper.editMethodName</code> - The method name to call for a GET
 *       request with an id parameter and the 'edit' view specified. Defaults to 'edit'.
<code>struts.mapper.newMethodName</code> - The method name to call for a GET
 *       request with no id parameter and the 'new' view specified. Defaults to 'editNew'.

//to circumvent REST mapping you can simply assign  "name!method" convention.
        String name = mapping.getName();
        int exclamation = name.lastIndexOf("!");
        if (exclamation != -1) {
            mapping.setName(name.substring(0, exclamation)); //name=name
            mapping.setMethod(name.substring(exclamation + 1)); //method=method
        }

//HERE are your ROR Rest-style mappings:

//GET customers_path becomes /customers_path method=index 
//reason: GET request with no id default method name is 'index'

//GET customer_path/1 becomes /customers_path method="show" id=1 
//reason: GET request with id defaults to method show with id assigned 1

//GET /customers/new becomes /customers method='editNew'
//reason: The method name to call for a GET request with no id parameter and the //'new' view specified. Defaults to 'editNew'.

//POST /customers becomes /customers method='create'
//reason: POST with no id method defaults to method create

//GET /customers/1;edit becomes /customers method='edit' id=1
//reason: GET request with edit view specified ..defaults to edit method

//PUT /customers/1 = customers method="update" id="Thrillers"

//reason: PUT with an id (1) method defaults to update method


//DELETE /customers/1 = customers method="destroy" id="1"
//reason PUT with an id method defaults to destroy

mr don writes in the notes:
/* This Restful action mapper enforces Ruby-On-Rails Rest-style mappings.  If the method 
 * is not specified (via '!' or 'method:' prefix), the method is "guessed" at using 
 * ReST-style conventions that examine the URL and the HTTP method.  Special care has
 * been given to ensure this mapper works correctly with the codebehind plugin so that
 * XML configuration is unnecessary.
*/

Does this conform to your understanding of ROR REST-style mappings?
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: Sat, 14 Mar 2009 21:43:54 -0700
> From: dustin_pearce@yahoo.com
> To: user@struts.apache.org
> Subject: RE: this is driving me nucking futs!
> 
> 
> @Chris - Those are definitely good points.  I think that our first priorities
> for the applications we build for the Health System are maintainability &
> readability.  We don't have the performance needs of a major public internet
> site.  Our sites are pretty zippy. ;-)  Usually we have more large dataset
> related issues than throughput.    I suppose in a major system you could
> subdivide your routes into different includes for different modules.  I
> think if I was having performance issues, I would look a few other places
> first before I look before reducing the number of variables.
> 
> @MG - maven scripts for Ruby on Rails?  Am I missing something?  JRuby
> perhaps?  but its a struts forum, so we can move on... ;-)
> 
> In the example there is one namespace with all the RESTful actions
> associated with a Customer (index, show, new, create, edit, update,
> destroy).  When creating the links, the ids change plurality based on
> conventions I have seen:
> 
> //GET /customers/index = customers_path
> //GET /customers/show?id=1 = customer_path
> //GET /customers/new = customers_new_path
> //POST /customers/create = customers_create_path
> //GET /customers/edit?id=1 = customer_edit_path
> //POST /customers/update = customer_update_path
> //POST /customers/destroy?id=1 = customer_destroy_path
> 
> You can place your <s:url/> inline for the anchor's href attribute.  I think
> my intent was to abstract the view page from the action's implementation
> which allows me to update the namespace or action without a big search and
> replace.   With refactor tools these types of updates are pretty trivial. 
> IMO, the url "reads" better with the JSTL variable reference.
@MG yes JSTL is easier to read than OGNL 

> On precedence, the short answer is I don't.  I set includeParams default
> globally to false and just deal with query strings, "the old way".   Its
> just my preference, but I like to see the querystring params on each link
> rather than just the unique additions on top of the existing GET params.  I
> think my general habits keep the querystrings fairly light, but in a
> situation where you need a big complex querystring that you are chaining you
> can always put in an "exception" and do it however you want for that case.
> 
> I have not built anything that needed a performance boost from offloading
> static resource loading from another server.  I have read that this is a
> common technique used to gain some perceived performance gain on the browser
> side.  
> 
> On the maven archetype, I wish I wasn't so lazy.  I still need to create an
> archetype for the template we are using for our apps.  We stripped Appfuse
> and retooled it with some better unit test classes and integrated it with
> SSO (Crowd) and we just need to get it all wrapped up.  I really need to
> create a template folder for Musachy's StrutsOn so I can use Groovy to
> generate all the Dao/Managers/Controllers/Views for basic CRUD based on
> models.    Maybe one night I can put down Left4Dead and get some work done
> instead....
> 
> 
> mgainty wrote:
> > 
> > 
> > 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:
> >> 
> >> &lt;a href="${customers_path}">Customers Index&lt;/a>
> > MG>anchor href uses prebuilt urls is already implemented in showcase.jsp
> > (v2.1.6)
> > MG><li> <s:url action= includeParams="none" />">Action Chaining </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.
> >> 
> >> &lt;a href="${customer_path}?id=${customer.id}">Customers Index&lt;/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_pearce@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_pearce@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-unsubscribe@struts.apache.org
> >> >> >> > For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> >> >> >> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> >> >> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >> 
> > 
> > _________________________________________________________________
> > Windows Live™: Life without walls.
> > http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_032009
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/this-is-driving-me-nucking-futs%21-tp22463203p22519872.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@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

RE: this is driving me nucking futs!

Posted by dusty <du...@yahoo.com>.
@Chris - Those are definitely good points.  I think that our first priorities
for the applications we build for the Health System are maintainability &
readability.  We don't have the performance needs of a major public internet
site.  Our sites are pretty zippy. ;-)  Usually we have more large dataset
related issues than throughput.    I suppose in a major system you could
subdivide your routes into different includes for different modules.  I
think if I was having performance issues, I would look a few other places
first before I look before reducing the number of variables.

@MG - maven scripts for Ruby on Rails?  Am I missing something?  JRuby
perhaps?  but its a struts forum, so we can move on... ;-)

In the example there is one namespace with all the RESTful actions
associated with a Customer (index, show, new, create, edit, update,
destroy).  When creating the links, the ids change plurality based on
conventions I have seen:

//GET /customers/index = customers_path
//GET /customers/show?id=1 = customer_path
//GET /customers/new = customers_new_path
//POST /customers/create = customers_create_path
//GET /customers/edit?id=1 = customer_edit_path
//POST /customers/update = customer_update_path
//POST /customers/destroy?id=1 = customer_destroy_path

You can place your <s:url/> inline for the anchor's href attribute.  I think
my intent was to abstract the view page from the action's implementation
which allows me to update the namespace or action without a big search and
replace.   With refactor tools these types of updates are pretty trivial. 
IMO, the url "reads" better with the JSTL variable reference.

On precedence, the short answer is I don't.  I set includeParams default
globally to false and just deal with query strings, "the old way".   Its
just my preference, but I like to see the querystring params on each link
rather than just the unique additions on top of the existing GET params.  I
think my general habits keep the querystrings fairly light, but in a
situation where you need a big complex querystring that you are chaining you
can always put in an "exception" and do it however you want for that case.

I have not built anything that needed a performance boost from offloading
static resource loading from another server.  I have read that this is a
common technique used to gain some perceived performance gain on the browser
side.  

On the maven archetype, I wish I wasn't so lazy.  I still need to create an
archetype for the template we are using for our apps.  We stripped Appfuse
and retooled it with some better unit test classes and integrated it with
SSO (Crowd) and we just need to get it all wrapped up.  I really need to
create a template folder for Musachy's StrutsOn so I can use Groovy to
generate all the Dao/Managers/Controllers/Views for basic CRUD based on
models.    Maybe one night I can put down Left4Dead and get some work done
instead....


mgainty wrote:
> 
> 
> 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:
>> 
>> &lt;a href="${customers_path}">Customers Index&lt;/a>
> MG>anchor href uses prebuilt urls is already implemented in showcase.jsp
> (v2.1.6)
> MG><li> <s:url action= includeParams="none" />">Action Chaining </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.
>> 
>> &lt;a href="${customer_path}?id=${customer.id}">Customers Index&lt;/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_pearce@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_pearce@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-unsubscribe@struts.apache.org
>> >> >> > For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>> >> >> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
> 
> _________________________________________________________________
> Windows Live™: Life without walls.
> http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_032009
> 

-- 
View this message in context: http://www.nabble.com/this-is-driving-me-nucking-futs%21-tp22463203p22519872.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


RE: this is driving me nucking futs!

Posted by Martin Gainty <mg...@hotmail.com>.
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:
> 
> &lt;a href="${customers_path}">Customers Index&lt;/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.
> 
> &lt;a href="${customer_path}?id=${customer.id}">Customers Index&lt;/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_pearce@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_pearce@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-unsubscribe@struts.apache.org
> >> >> > For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> >> >> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
Windows Live™: Life without walls.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_032009

RE: this is driving me nucking futs!

Posted by dusty <du...@yahoo.com>.
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:

&lt;a href="${customers_path}">Customers Index&lt;/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.

&lt;a href="${customer_path}?id=${customer.id}">Customers Index&lt;/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_pearce@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_pearce@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-unsubscribe@struts.apache.org
>> >> > For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: this is driving me nucking futs!

Posted by Martin Gainty <mg...@hotmail.com>.
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_pearce@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_pearce@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-unsubscribe@struts.apache.org
> >> > For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@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

RE: this is driving me nucking futs!

Posted by dusty <du...@yahoo.com>.
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_pearce@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-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: this is driving me nucking futs!

Posted by Dave Newton <ne...@yahoo.com>.
Martin Gainty 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?

Yeah, so if the action is in another namespace you can refer to it.

> 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

It's already been done, as Musachy said:

https://issues.apache.org/struts/browse/WW-3037

Dave


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


RE: this is driving me nucking futs!

Posted by Martin Gainty <mg...@hotmail.com>.
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_pearce@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-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@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

Re: this is driving me nucking futs!

Posted by dusty <du...@yahoo.com>.
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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: this is driving me nucking futs!

Posted by Dave Newton <ne...@yahoo.com>.
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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: this is driving me nucking futs!

Posted by Martin Gainty <mg...@hotmail.com>.
Mitch-

<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head><title>Numbers Game</title>
<SCRIPT LANGUAGE="JavaScript">
var submitcount=0;
function submitForm()
{
  var url ='http://localhost:8080/struts2-showcase-2.1.2/action' + escape(document.form.select.value);
  document.form.action=url;
  alert(url);
  document.form.submit();
}
</script>  
</head>

<body>
<h1>Numbers Game</h1>
<form method="GET" name="form" action='http://localhost:8080/struts2-showcase-2.1.2?FacilityID=' + escape(document.form.select.value)>
<table>
 <s:select
   label="select" 
   name="select"
   id="select"
   list="#{'username1':'trillian',
    'username2':'zaphod'}" 
    value="%{#select}"/>
    
   <s:submit theme="simple" type="submit" value="submit" id="button" onclick="submitForm();" onMouseUp="submitForm();"/>
</table>
<p>
</form>
</body>
</html>

OGNL and JSTL use back end (Bean) objects to store and retrieve <attributes of> back end objects
your submit tag can call JavaScript which will construct a url variable as illustrated here
just be sure to assign document.form.action=url before submitting as seen in submitForm()

HTH
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: Wed, 11 Mar 2009 17:17:13 -0400
> From: mgorman@shadowtv.biz
> To: user@struts.apache.org
> Subject: Re: this is driving me nucking futs!
> 
> Musachy Barroso wrote:
> > That is something I have complained about for a long time, time to do
> > something about it I guess.
> >   
> 
>     I AM AN INSTRUMENT OF CHANGE!!!
> 
> ;)
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
Express your personality in color! Preview and select themes for Hotmail®. 
http://www.windowslive-hotmail.com/LearnMore/personalize.aspx?ocid=TXT_MSGTX_WL_HM_express_032009#colortheme

Re: this is driving me nucking futs!

Posted by mitch gorman <mg...@shadowtv.biz>.
Musachy Barroso wrote:
> That is something I have complained about for a long time, time to do
> something about it I guess.
>   

    I AM AN INSTRUMENT OF CHANGE!!!

;)



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


Re: this is driving me nucking futs!

Posted by Musachy Barroso <mu...@gmail.com>.
That is something I have complained about for a long time, time to do
something about it I guess.

musachy

On Wed, Mar 11, 2009 at 5:08 PM, Chris Pratt <th...@gmail.com> wrote:
> I guess one question I would ask is why <s:a> doesn't have an action
> paramter and allow nested <s:param> elements?  That way there would be no
> need to create any variables.
>  (*Chris*)
>
> On Wed, Mar 11, 2009 at 1:56 PM, mitch gorman <mg...@shadowtv.biz> wrote:
>
>> Wes Wannemacher wrote:
>> > On Wed, Mar 11, 2009 at 4:47 PM, mitch gorman <mg...@shadowtv.biz>
>> wrote:
>> >
>> >>    thanks for your responses, wes!
>> >>
>> >>
>> >
>> > No problem, next time, include me in your list of gurus and I'll be happy
>>
>>     lol!  you got it!
>>
>>    (i knew for sure i was probably inadvertently dissing at least a
>> couple people here... my apologies to any *other* deserving souls!)
>>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: this is driving me nucking futs!

Posted by Chris Pratt <th...@gmail.com>.
I guess one question I would ask is why <s:a> doesn't have an action
paramter and allow nested <s:param> elements?  That way there would be no
need to create any variables.
  (*Chris*)

On Wed, Mar 11, 2009 at 1:56 PM, mitch gorman <mg...@shadowtv.biz> wrote:

> Wes Wannemacher wrote:
> > On Wed, Mar 11, 2009 at 4:47 PM, mitch gorman <mg...@shadowtv.biz>
> wrote:
> >
> >>    thanks for your responses, wes!
> >>
> >>
> >
> > No problem, next time, include me in your list of gurus and I'll be happy
>
>     lol!  you got it!
>
>    (i knew for sure i was probably inadvertently dissing at least a
> couple people here... my apologies to any *other* deserving souls!)
>

Re: this is driving me nucking futs!

Posted by mitch gorman <mg...@shadowtv.biz>.
Wes Wannemacher wrote:
> On Wed, Mar 11, 2009 at 4:47 PM, mitch gorman <mg...@shadowtv.biz> wrote:
>   
>>    thanks for your responses, wes!
>>
>>     
>
> No problem, next time, include me in your list of gurus and I'll be happy

    lol!  you got it!

    (i knew for sure i was probably inadvertently dissing at least a
couple people here... my apologies to any *other* deserving souls!)

Re: this is driving me nucking futs!

Posted by Wes Wannemacher <we...@wantii.com>.
On Wed, Mar 11, 2009 at 4:47 PM, mitch gorman <mg...@shadowtv.biz> wrote:
>
>    thanks for your responses, wes!
>

No problem, next time, include me in your list of gurus and I'll be happy.

-Wes

-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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


Re: this is driving me nucking futs!

Posted by mitch gorman <mg...@shadowtv.biz>.
Wes Wannemacher wrote:
> On Wed, Mar 11, 2009 at 4:39 PM, mitch gorman <mg...@shadowtv.biz> wrote:
>   
>> Musachy Barroso wrote:
>>     
>>> Ok, first, you don't need to define variable for each url, you can just do
>>>
>>> <s:url id="myurl" ..
>>> <s:a href="%{#myurl}" ...
>>>
>>>       
>>    this was the very first thing i attempted... it was the logical
>> first attempt.  unfortunately, what i ended up with when i did that was
>> a set of links to the last loop iteration's URL.  now, granted, i hadn't
>> been using struts very long at that point, so maybe i'd screwed
>> something else up.  i can certainly try this again...
>>     
>
> This would probably happen if you were outside of the closing iterator tag.
>   

    yup.  color me "embarrassed"... it just worked perfectly!  clearly,
i'd messed something else up when i tried it the first go-round.

    *sigh*

    thanks for your responses, wes!


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


Re: this is driving me nucking futs!

Posted by Wes Wannemacher <we...@wantii.com>.
On Wed, Mar 11, 2009 at 4:39 PM, mitch gorman <mg...@shadowtv.biz> wrote:
> Musachy Barroso wrote:
>> Ok, first, you don't need to define variable for each url, you can just do
>>
>> <s:url id="myurl" ..
>> <s:a href="%{#myurl}" ...
>>
>    this was the very first thing i attempted... it was the logical
> first attempt.  unfortunately, what i ended up with when i did that was
> a set of links to the last loop iteration's URL.  now, granted, i hadn't
> been using struts very long at that point, so maybe i'd screwed
> something else up.  i can certainly try this again...

This would probably happen if you were outside of the closing iterator tag.



-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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


Re: this is driving me nucking futs!

Posted by mitch gorman <mg...@shadowtv.biz>.
Musachy Barroso wrote:
> Ok, first, you don't need to define variable for each url, you can just do
>
> <s:url id="myurl" ..
> <s:a href="%{#myurl}" ...
>   
    this was the very first thing i attempted... it was the logical
first attempt.  unfortunately, what i ended up with when i did that was
a set of links to the last loop iteration's URL.  now, granted, i hadn't
been using struts very long at that point, so maybe i'd screwed
something else up.  i can certainly try this again...

> inside the iterator, that will make your life easier. Assuming the
> code was just an example, and you *really* need to create a bunch of
> URLs and then use them, you can do it like this:
>
>  <s:iterator var="i" begin="0" end="10">
>         <s:url id="link%{#i}" value="/something/%{#i}" />
>  </s:iterator>
>
>  <s:iterator var="i" begin="0" end="10">
>       <s:a href="%{#context['link'+ #i]}">somelink</s:a>
>  </s:iterator
    well, i can't do that exactly, since i'm using v2.0.14 (no "begin",
"end" attributes).  however,

"%{#context['link'+ #i]}"

    is intriguing.  would such a construct work in v2.0.14?


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


Re: this is driving me nucking futs!

Posted by Musachy Barroso <mu...@gmail.com>.
Ok, first, you don't need to define variable for each url, you can just do

<s:url id="myurl" ..
<s:a href="%{#myurl}" ...

inside the iterator, that will make your life easier. Assuming the
code was just an example, and you *really* need to create a bunch of
URLs and then use them, you can do it like this:

 <s:iterator var="i" begin="0" end="10">
        <s:url id="link%{#i}" value="/something/%{#i}" />
 </s:iterator>

 <s:iterator var="i" begin="0" end="10">
      <s:a href="%{#context['link'+ #i]}">somelink</s:a>
 </s:iterator>

musachy

On Wed, Mar 11, 2009 at 3:58 PM, mitch gorman <mg...@shadowtv.biz> wrote:
>    okay, can anyone (musachy, david, martin, i'm looking in your
> direction!) tell me how to do what i'm trying to do, here?
>
>    i've got a list of items i'm iterating over.  for each item, i want
> to have one or more links to actions, with parameterization from the
> item's data.  this means, using a unique value for each <s:url> tag's id
> attribute.  the trouble comes in trying to reference the unique id value
> in my <s:a> tag.
>
>    a trivial example will demonstrate my quandary more clearly:
>
> <s:iterator value="listItems" status="rowstatus">
>    <s:push value="#rowstatus">           <%-- done to make actual code a
>                                            little cleaner to read; this
> example
>                                            doesn't really need it --%>
>
>        <%-- the following correctly puts "link-1", "link-2", etc, into
> the stack context --%>
>        <s:url id="link-%{count}" namespace="/" action="linkAction">
>          <s:param name="count" value="%{count}" />      <%-- purely for
> the example --%>
>        </s:url>
>
>        <s:a href="WHAT GOES HERE??!?">
>            Link #<s:property value="%{count}" />
>        </s:a>
>    </s:push>
> </s:iterator>
>
>    how can i get the proper "#link-<count value>" into that href field
> in my JSP, to be dereferenced by struts (in the resulting html sent to
> the browser) into the actual URL assembled specifically for that item?
> i've tried dozens of syntactical constructions, none of which worked.
> the closest i ever got was to see URLs that looked like
> "http://my.com/linkAction.do?link-2"... just couldn't get that "link-2"
> string to be properly parsed by struts as an "argument" to the "#"...
> i've tried various combinations with <s:push> and <s:set>, but
> ultimately, i come down to needing something like "%{#( ...%{#...})}"
> ...and that definitely doesn't fly!
>
>    any thoughts on how to accomplish this?  i can't believe i'm the
> first person to ever want to do something like this...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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