struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From new2you <new2...@gmx.de>
Subject Struts 2 - radio inside iterator
Date Sun, 26 Aug 2007 11:37:20 GMT

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


Mime
View raw message