Provide transparent support for session-scope checkboxes
---------------------------------------------------------
Key: WW-1372
URL: http://issues.apache.org/struts/browse/WW-1372
Project: Struts 2
Type: Improvement
Reporter: Ted Husted
Fix For: Future
HTML checkboxes have a quirk in that if the checkbox is clear (false), browsers
are not required to submit the control. If the control is set, the control is
submitted as "control_name=control_name", but in the case of a clear checkbox,
nothing is expected to be submitted.
Accordingly, it is impoort to set the property backing the checkbox to false
when a form is rendered. If the checkbox submits back clear, it will remain
false, if the form submits back, the field can be set to true to reflect the
change.
However, if the form is being held in session scope, prematurely setting the
value to false can be dangerous. If the form is never submitted back, the value
will remain false. If the form is later committed to persistent store, an
inadvertent change in state will occur. This can be a real problem when using
POJOs backed by a persistence system like Hibernate.
One workaround is to create action-properties for session-scope checkboxes and
update the POJO in the action.
Another solution is to use a naming convention in conjection with an
interceptor to set missing checkboxes to true.
For additional background, see
[http://forums.opensymphony.com/thread.jspa?forumID=1&threadID=23601].
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira