Leandro Melo wrote:

Suppose a user submits a request that is handled by
MyActionDoSomething. Then this action sets a request
attribute like this:

request.setAttribute("MyObject", obj);

and forwards the request to the page
myPageDoSomeOtherThing.jsp, wich has some inputs for
the user to fill in.

The problem you are describing comes up a lot on this list - when validation fails and you are back on the initial form you will not have access to the previous set request attributes. It is for this reason that I now rarely ever set my mapping validate to "true" and instead call validate() from my Action after the form submits. The reason for this is when validation fails (ActionErrors/Messages return) I can then call a private setUp() method in my Action that is used to set up my form with any other request attributes that should always be there.


For example, a common complaint is: "I have a List that I set up in request scope that is used on the form for the user to select an item, but when validation fails this List will not be there." To get around this problem, simply call validate() manually in your action and if errors return you can then call a setUp() method that will repopulate what you need to be in the request, otherwise you just proceed on as normal.

--
Rick

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



Reply via email to