You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dan Eklund <DE...@intralinks.com> on 2003/07/18 01:55:39 UTC

question about reset() and multiple action forwards...

I have a scenario where an action-form goes through 2 actions before 
getting to the view...

the problem that reset() solves (for multiboxes) is that because the 
browser does not send any values 
to indicate that the user checked OFF all the multiboxes, you should 
reset( ) to a
blank slate for your String[ ] instance representing AND THEN the struts 
servlet will re-add
any checboxes submissions using the mutator method

this seems to work on the first of the action (where i've set debug 
statements to see that the
struts servlet has indeed re-added the values from the request).... 
however, when the request
gets forwarded to the second action it servlet doesn't want to re-add the 
values into the action form...
(after my reset() method gets called again leaving only a blank slate)

i suspect that once the first action is re-constitued with the checkbox 
values it removes the attributes
from the response... (just a guess)...

is there an elegant way (?declarative?) for getting around this??

I guess I could do something like this :

    public void reset(ActionMapping mapping,
                      HttpServletRequest request){

        if(mapping.getForward().equals("first action identifier only")
        {
                // only reset for the first action
                this.chosenMultiBoxValues = new String[0];
        }
    }

...  has this been an issue with anyone??