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 <mgor...@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-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