Struts 2 checkbox – not checked – wierd behaviour with checking and unchecking of checkbox

This is the right way to use a checkbox in struts 2 or sturts 1:
The checkbox field should be backed by a boolean. In struts 2, the fieldValue attrubute of s:checkbox should be true. So when the box is checked and the form is submitted, the field value will be set to true. An added advantage in struts 2 is that you don’t have reset the field values to false. Struts 2 will automatically set it to false if that parameter doesn’t exist in the http post.

Avoid the common mistake of using non boolean fields for checkbox.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: