You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vijay Prajapati <vi...@realsoftinc.com> on 2007/02/20 15:17:10 UTC

Regarding dynamic radio button..

I am using Struts2.0.1.
I have created groups of 3 dynamic radiobuttons through iterator(Array
List) tag. But I have to give different names to these groups. I am here
giving code which I have been written in my jsp.
 
<s:iterator status="stat" value="groupname">
 <tr>
    <td class="txt"><strong><s:property/></strong></td>
    <td class="txt"><s:radio list="{'None','Admin','Developer'}"
name="groupname[%{#stat.index}].value"/>
    </td>
 </tr>
</s:iterator>
 
Here “groupname” is collection(ArrayList which store groupname(String))
in Action class. So can I user name as value of collection so every
radio button would have different name as per collection value?
 
So Help me to assign different names for each radio button group.
 
With Regards,

| Vijay Prajapati |  
| Sr. Software Engineer |  
| Real Soft (Intl) Pvt. Ltd, Vadodara  | 
| SEI-CMM Level IV & ISO 9001:2000 Company  |  
|  Phone: (0265) 5563097, 5598758, 5598626, 5598630  |  
Cell No: +91 9898149407
 <mailto:vijay.prajapati@realsoftinc.com >
vijay.prajapati@realsoftinc.com 

 

RE: Regarding dynamic radio button..

Posted by Vijay Prajapati <vi...@realsoftinc.com>.
Hi Tim,
       Could you please send me your code with nested tag so I can get
something from it.

Thank you,
Vijay Prajapati

-----Original Message-----
From: Tim Williams [mailto:williamstw@gmail.com] 
Sent: Tuesday, February 20, 2007 8:39 PM
To: Struts Users Mailing List
Subject: Re: Regarding dynamic radio button..

On 2/20/07, Vijay Prajapati <vi...@realsoftinc.com> wrote:
>
>
>
>
> I am using Struts2.0.1.
>
> I have created groups of 3 dynamic radiobuttons through iterator(Array
List) tag. But I have to give different names to these groups. I am here
giving code which I have been written in my jsp.
>
>
>
> <s:iterator status="stat" value="groupname">
>
>  <tr>
>
>     <td class="txt"><strong><s:property/></strong></td>
>
>     <td class="txt"><s:radio list="{'None','Admin','Developer'}"
name="groupname[%{#stat.index}].value"/>
>
>     </td>
>
>  </tr>
>
> </s:iterator>
>
>
>
> Here "groupname" is collection(ArrayList which store
groupname(String)) in Action class. So can I user name as value of
collection so every radio button would have different name as per
collection value?
>
>
>
> So Help me to assign different names for each radio button group.

I'm doing something similiar using the nested tags.  It provides the
unique naming for you. I explicitly create the radio buttons with the
nested:radio tag though.  I use nested:iterate in the same way you use
s:iterate.  Since you have to pass the list into the radio tags, I
reckon it wouldn't hurt for you to also explicitly list out the
buttons.  Anyway, if you have any flexibility, you may want to take a
look at the nested tags before trying to do it yourself.

--tim

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


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


Re: Regarding dynamic radio button..

Posted by Tim Williams <wi...@gmail.com>.
On 2/20/07, Vijay Prajapati <vi...@realsoftinc.com> wrote:
>
>
>
>
> I am using Struts2.0.1.
>
> I have created groups of 3 dynamic radiobuttons through iterator(Array List) tag. But I have to give different names to these groups. I am here giving code which I have been written in my jsp.
>
>
>
> <s:iterator status="stat" value="groupname">
>
>  <tr>
>
>     <td class="txt"><strong><s:property/></strong></td>
>
>     <td class="txt"><s:radio list="{'None','Admin','Developer'}" name="groupname[%{#stat.index}].value"/>
>
>     </td>
>
>  </tr>
>
> </s:iterator>
>
>
>
> Here "groupname" is collection(ArrayList which store groupname(String)) in Action class. So can I user name as value of collection so every radio button would have different name as per collection value?
>
>
>
> So Help me to assign different names for each radio button group.

I'm doing something similiar using the nested tags.  It provides the
unique naming for you. I explicitly create the radio buttons with the
nested:radio tag though.  I use nested:iterate in the same way you use
s:iterate.  Since you have to pass the list into the radio tags, I
reckon it wouldn't hurt for you to also explicitly list out the
buttons.  Anyway, if you have any flexibility, you may want to take a
look at the nested tags before trying to do it yourself.

--tim

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