• 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

Retaining value of checkbox on the form

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an array of checkboxes in my JSP. I am doing a validation that only two of these boxes can be selected but after the validation when the page shows all the checkboxes show as unchecked. How can I retain the value of the checkboxes in the form?

My code is posted below
<logic:iterate id="cList" name="cActionForm" property="cList" indexId="cListIndex">
<td><html:checkbox styleClass="checkRowsCheckbox" styleId="chkRow${cListIndex}" name="cList" property="checked" indexed="true" value="${cListIndex}"/></td>
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, there's an administrative matter you need to attend to:

The name you are currently displaying with your posts does not meet the requirements of the JavaRanch naming policy. Specifically, it requires that you use a first and last name that is not obviously fictitions. You can use the my profile link to change it.

Please change it before your next post.

Regarding your question:

Have you provided an indexed getter in the ActionForm with the following signature?
<blockquote>code:
<pre name="code" class="core">public SomeObject getCList(int index)</pre>
</blockquote>
Where SomeObject is the object the list contains.

Furthermore, have you provided lazy initialization behavior for this getter? The following link explains more about this.

http://wiki.apache.org/struts/StrutsCatalogLazyList
[ July 16, 2008: Message edited by: Merrill Higginson ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic