You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by new2you <ne...@gmx.de> on 2007/08/26 13:37:20 UTC

Struts 2 - radio inside iterator

Hi,
I've seen tons of similar posts here, but no solution:
I want to create a table of users, each row represents 1 user and has 3
radio buttons, which determine the user's role in the application. A user
can only have 1 role.
So I created the following code(shortened):

<s:iterator value="userList">
  <tr>
    <td>
      ... ... ... ... <s:radio name="role" list="{0, 1, 2}"></s:radio>
  </tr>
</s:iterator>

Expl.:
userList: a List of "User"s
role: Integer property of entity "User". 
0, 1, 2: possible roles.

obviously, this cant work since the name of each radio is the same for all
the radios in the whole table.
No radio is correctly checked when accessing the page.
So I want an individual name for each radio-row, but without losing their
prepopulation.
So I've tried a map approach:
  name="userList[#{id}].role"
doesnt work either.

funny thing is, if I use s:textfield this way, it gets pre-populated just
fine.

What would be the best way to approach this?

thanks
Toby
-- 
View this message in context: http://www.nabble.com/Struts-2---radio-inside-iterator-tf4330842.html#a12334122
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