struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <newton.d...@yahoo.com>
Subject Re: S2 tags - dynamic attributes
Date Wed, 03 Sep 2008 15:43:15 GMT
--- On Wed, 9/3/08, Jonny Cavell wrote:
> Firstly, I want the id attribute of any HTML tag to take a
> dynamic value, so that I can code it at runtime. Secondly
> I want the tag to take e.g. dojoType as an attribute:
> 
> <s:iterator value="#xxx" status="itStatus" var = "yyy">
>   <s:radio dojoType="zzz" id="#{itStatus}" 
>            list="#{'0':'', '1':'', '2':'', '3':'', '4':'', '5':''}">
>   </s:radio>
> <s:iterator>

(1) Your OGNL expression for the "id" attribute is incorrect, plus you need to force evaluation
for "id":

id="%{#itStatus.index}"

Or .count, if you want it starting at 1. See [1,2].

(2) You can't just randomly add attributes to JSP tags... Depending on what your actual needs
are you may be able to get by with an "onclick" handler and some JavaScript.

Dave

[1] Iterator tag: http://struts.apache.org/2.x/docs/iterator.html
[2] IteratorStatus: 
http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/views/jsp/IteratorStatus.html


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


Mime
View raw message