________________________________
From: Alex Siman <aleksandr.si...@gmail.com>
To: user@struts.apache.org
Sent: Mon, October 5, 2009 8:10:53 PM
Subject: Re: Struts 2 runtime variable names


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()"

try {'form.cvgcode'+#index_count.count} and you don't have to declare and 
increment i.

> 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}" 

{'form.cvglimit'+#index_count.count}

http://struts.apache.org/2.1.8/docs/iterator.html

>             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-tp25761232p25762277.html
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to