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 <mgor...@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-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org