struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Hammer <carsten.ham...@t-online.de>
Subject validate= true destroys form defaults
Date Tue, 25 Mar 2003 20:01:29 GMT
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


Mime
View raw message