Announcement Announcement Module
No announcement yet.
Why does AbstractFormController remove form from session? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why does AbstractFormController remove form from session?


    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?



  • #2
    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.