I have a j2ee application running on weblogic. I was confused with my multibox.
What I know of multibox is that the checked items will be passed as an array of strin
Are you familiar with the reset() method on the ActionForm class?
The purpose in life for this method is to reset checkboxes. If you have a checked checkbox in your form and you submit it, that checkbox will be on the request. If the checkbox is unchecked nothing will be sent on the request for it (a GET submit is a simple way to observe this behavior).
When Struts performs the request bind, it matches by name the parameters from the request to the parameters in the form. That is, if there is something to match.
Now consider these steps:
The above applies for multi checkboxes, but you get an array instead of just one value.
Enter the reset() method. This is called by Struts before binding the request. Here you can set your field value to false. If it arrives in the request Struts will replace it with true => OK. If it does not arrive on the request (because it's unchecked) the value will remain false = > OK again.
The same goes for multiboxes. You have to reset the list of values from the ActionForm by reducing the array to zero length (but not null).
If your ActionForm has a request scope, it usualy does not matter because the object is recreated at each request. But for a session scoped ActionForm with checkboxes, reset() is a must.