struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Tran" <dantt...@hotmail.com>
Subject Re: validate= true destroys form defaults
Date Tue, 25 Mar 2003 20:21:28 GMT
This is my be a long shot, but I encountered it before.
Makesure to make all your actions to have the same scope In this case:
request.  Do not leave it blank.
]-D
----- Original Message -----
From: "Carsten Hammer" <carsten.hammer@t-online.de>
To: <struts-user@jakarta.apache.org>
Sent: Tuesday, March 25, 2003 12:01 PM
Subject: validate= true destroys form defaults


> Hi,
> I use a dispatchaction to set actionform parameters using the actionform
> setter methods (I do not write it to the session!). The flow is this way:
>
> 1. Url: http://localhost:8080/mydispatchaction.do?method=view ;here the
> information is pulled from the database and put to the actionformbean
> using its setter methods.
> 2. This mydispatchaction.do forwards to the jsp. There the information
> from the database is presented and can be changed and submitted again to
> the mydispatchaction.do?method=save
>
> This all works as expected.
>
> Unfortunatly as soon as I switch on the validate switch in the struts
> config (1.1x) the information that was written to the actionformbean
> seems to get lost and  the jsp presents empty html:text fields. It seems
> like using the validate=true switch makes the actionformbean to be
> instantiated again. I can see the reset method is called between the
> setting of the formbean parameters and the viewing of the jsp because
> all parameters get the values set in the reset method if set there when
> using validate=true. All former settings get lost then of course.
>
> I do not understand why this is the case. How should the validate switch
> be used then? Or do I have to write the information that I want to
> present in a jsp using a actionform always into the session? I thought
> it should be possible to write it to the actionform inside of the
> dispatchaction if it is possible to read it from the actionform in the
> dispatchaction.
>
> Can anybody explain to me the "best practice" is in this case? How does
> the lifecycle look like of an actionform (for request scope settings in
> the struts config)?
> Best regards,
> Carsten Hammer
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message