>>>>> "Antoni" == Antoni Reus <[EMAIL PROTECTED]> writes:

    Antoni> Hi,
    Antoni> A Dissabte 12 Octubre 2002 14:08, Howard Miller va escriure:
    >> Hi,
    >> 
    >> Can soebody explain when the reset method of ActionForm gets called?
    >> 
    >> My problem is that I am using the method to prepopulate the form (which
    >> works). The previous jsp had a link to the following jsp (the jsp not its
    >> action - .jsp not .do, ok). The reset obviously runs and the preloaded
    >> values appear.
    >> 
    >> When I submit the form, the reset method appears to get called again, so I
    >> lose my user entered values. Not wat I expected. And yes the <html.form>
    >> tag does point to the .do action.

    Antoni> The reset method is called on every request that uses the form, before 
    Antoni> populating it with the parameters in the current request, and calling the 
    Antoni> action.

    Antoni> You can do a "selective" reset with something like this

    Antoni> public void reset ( mapping, request) {

    Antoni>     if (!mapping.getPath().equals( "whatever"))  {
    Antoni>             // do the reset
    Antoni>     } 
    Antoni> }

>From the original description, it sounds like your "reset" method is using
business logic to get data values to populate your fields with.

>From Antoni's explanation of how "reset" is used, I hope it's clear that won't
work very well.

The ActionForm.reset() method should only be used to CLEAR form values, before
they are populated from the request.  You should use business logic in your
Action class to populate form beans.

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to