Felipe Rodrigues wrote:
I'm sorry about don't provide all the informations. I'll try to explain a
little more.
I'm trying to generate a <s:a> tag for each item in a list, but I have to
send a param when click on this <s:a> link.
This is why I use <s:url> to do that. My code seems like that:
<s:iterator value="type">
<tr>
<td>
<s:url id="url%{id}" action="Variables">
<s:param name="typeId" value="id"></s:param>
</s:url>
Again, why do you need to make the id attribute on the s:url tag
dynamic? Just use <s:url id="url" ... as I suggested in a previous post.
<s:a id="tipo${module}%{id}"
name="tipo${module}%{id}"
href="%{url}" <!-- Here is my problem. I need lots of url, but not
with the same id, because my param changes
according to the type I'm itereting
-->
You have href="%{url}" but used id="url%{id}" in the s:url tag above.
Fix the s:url tag, and this should work fine. The id attribute on the
s:a tag *does* need to be unique, since it becomes part of the rendered
HTML. The id attribute on the s:url tag doesn't, but the s:a's href
attribute must sync up with the s:url's id attribute.
cssClass="listItem"
notifyTopics="changeTypeListItem"
theme="ajax"
showLoadingText="false"><s:property value="dsc"/></s:a>
</td>
</tr>
</s:iterator>
I was doing this with <c:forEach>, but some changes in my project made me
change from <c:forEach> to <s:iterator>. When using forEach I could just use
EL, but with iterator, I can't (I think I can't, but not sure).
How could I do that in this case?
You should be able to get this working using either s:iterator or
c:forEach. Try the suggestion above and, if you still have problems,
post the errors you get and/or the incorrect markup that's produced.
L.
Thanks in advance,
Felipe
Laurie Harper wrote:
Why do you need to make the url-id unique on each loop iteration? Have
you tried simply writing something like
<c:forEach ...>
<s:url id="url" .../>
<s:a href="%{#id}" .../>
...
You should, on the other hand, provide a unique value for the 'id' (and
possibly 'name) attribute on the s:a tag as those get passed through to
the rendered HTML.
If you're still having trouble, try describing what exactly you are
trying to achieve, and posting a more complete code sample of how you're
trying to achieve it.
L.
Felipe Rodrigues wrote:
I'm sorry, but I didn't got it.
When I pass in a parameter, I'll send it to the destiny. That is not what
I
want. I only want to identify the url according to the id. This code is
inside a foreach, that renders lots of urls.
How would be that in this case?
Thanks,
Felipe
Martin Gainty wrote:
You'll need to pass in a parameter for id such as this
<s:url value="UpdateHome.selectPlant">
<s:param name="id" value="%{id}" />
</s:url>
M--
This email message and any files transmitted with it contain
confidential
information intended only for the person(s) to whom this email message
is
addressed. If you have received this email message in error, please
notify
the sender immediately by telephone or email and destroy the original
message without making a copy. Thank you.
----- Original Message -----
From: "Felipe Rodrigues" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Tuesday, May 08, 2007 3:31 PM
Subject: OGNL question
Hi,
How could i do that
<s:url id="setUsina${id}" action="UpdateHome!selectPlant">
</s:url>
<s:a id="any"
name="any"
href="%{setUsina${id}}" theme="ajax">Link</s:a>
changing EL by OGNL?
The especific part href="%{setUsina${id}}" . I tried
href="%{setUsina(#id)}" but didn't work.
Thanks,
Felipe
--
View this message in context:
http://www.nabble.com/OGNL-question-tf3711762.html#a10382481
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]