struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hisameer <cool_sameer_fo...@yahoo.com>
Subject Re: Struts 2 runtime variable names
Date Tue, 06 Oct 2009 03:59:43 GMT

Hi Alex,

Thank you very much for your help=). It worked like a charm. I tried using
s:set but forgot to put .count at the end of the index_count. But thanks for
figuring this out.

-Sameer



Alex Siman wrote:
> 
> I use such approach:
> 
> <s:iterator value="#session.coverageLimitList" status="index_count">
>     <s:set var="i" value="#index_count.count"/>
>     ...
>     "%{'form.cvgcode' + #i}"
>     ...
>     "%{'form.cvglimit' + #i}"
>     ...
> </s:iterator>
> 
> 
> hisameer wrote:
>> 
>> hello everyone,
>> 
>> I need to change the s:select name parameter's value depending on the
>> index of the list.
>> 
>> I have the following code :
>> 
>> <%! int i=1; %>
>>    <s:if test="#session.coverageLimitList.size>0">
>> 	<s:iterator value="#session.coverageLimitList" status="index_count">
>> 
>> 	<tr height="22">
>>          <td width="30%" class="contentheadertext1"
>> align="right"><s:property value="cvgDescription" />
>>          </td>
>> 	<td width="30%" class="contentheadertext1" align="center"><%= i
>> %><s:select   name="%     
>>               {'form.cvgcode'+i}" onchange="this.form.submit()"
>> headerKey="0" headerValue="Please Select" 
>>               required="true" list="cvgCode"  cssStyle="width:150px"
>> /></td>
>>         <td width="40%" class="contentheadertext1"
>> align="center"><s:select name="%{'form.cvglimit'+i}" 
>>             onchange="this.form.submit()" headerKey="0"
>> headerValue="Please Select" required="true" 
>>             list="cvglimit"  cssStyle="width:150px" /></td>
>> 
>>          <% i++; %>
>> 	</tr>
>>        </s:iterator>
>>     </s:if>
>> 
>> All I want is if the list is in the first level the name should be
>> form.cvgcode1 and so on. I tried using declaring a variable i and
>> incrementing it everytime but its not working. The value always being set
>> is form.cvgcodenull. Please advise me what should I do?
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Struts-2-runtime-variable-names-tp25761232p25762545.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


Mime
View raw message