• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts2 checkbox in iterator not working

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am trying to iterate over array of objects and disply checkbox as per the boolean value that is present in the model object. For some reason, it is not working. Below is what, I am doing:

<s:iterator value="objectsList" status="status" >
<TR>
<s:hidden name="objectsList[%{#status.index}].text" readonly="true"/>
<TD>
<s:property value="text" />
</TD>
<TD>
<s:checkbox name="objectsList[%{#status.index}].not" />
</TD>
<TD>
<s:textfield name="objectsList[%{#status.index}].value" />
</TD>
</TR>
</s:iterator>

In the above:
<s:property> and <s:textfield> are working properly as expected (both of them are Strings).

But for the Checkbox, it is not working. Even, if I select the checkbox and submit the form, the checkbox value (true) is not getting set in the model object and so, when the page got reloaded, it is still being shown as "unchecked".

In the above: "not" is a boolean variable and it had both setter and getter methods.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic