PDA

View Full Version : Why does AbstractFormController remove form from session?


Rexxe
Oct 2nd, 2004, 08:34 PM
Hello,

I have a controller which sets sessionForm to true. As a result, I'm expecting that the form is going to be put in session and available to my JSP and all future controllers. However, when I debug and look in the session, the attribute is not there. When I debugged further I noticed that line 434 of AbstractFormController actually removes the session attribute. Is this a bug? What is the purpose of removing the session attribute? I thought the whole purpose of setting the sessionForm flag was to tell the controller framework to get and set the form in session but why would it remove it? Is this a bug?

Thoughts?

--Rexxe

ojolly
Oct 3rd, 2004, 06:12 AM
This is not a bug.
The sessionForm property tells the form controller to keep the formBackingObject in the session between the form rendering and the submittion. For instance, you can see that in case of errors of binding or validation, the session is repopulated with the form so that even in case of errors and resubmition, the onSubmit-like method access the form data grabbed from the session.
Anyway, it is your duty, in the submit methods, to store the data in the session for future use.

Olivier