Jan 12th, 2008, 08:17 AM
Removing form session attribute ........
I had a problem with the session form. I wrote a controller which inherits SimpleFormController and set the sessionForm to true.
When i sent the first request to the server, a session is created see the log message below:
Setting form session attribute .....
and when i resend the request with some change in parameters i got to see the message
Removing form session attribute ...... <command class>
I think because of this i am getting NullPointerExceptions.
I dont know why its giving the message like this.
can any body say why its being removed from the session.
and how to overcome it.
Jan 12th, 2008, 11:46 PM
That's how the life cycle is with sessionForm set to true. When you show the first page/the form the command object is put into the session. When you submit the form the command object is retrieved AND removed from the session. Resubmitting the form is a kind of an illegal state. I don't see in which way you want to "fix" this.
Apr 8th, 2008, 02:33 AM
I'm having a similar issue. It may even be an identical issue.
My form is basically a search screen where the parameters to the search form the command object. On entering the screen, default search parameters are used. Then, the user can change the parameters and press submit any number of times to re-do the search and display the results.
When the form is first displayed, formBackingObject is called. This performs the default search.
Then, when submit is first done, the form bean is successfully retrieved from the session and it all works fine.
However, since the bean has now been removed from the session, next submit results in a : "Invalid submit detected: Form object not found in session (in session-form mode)" error. Consequently, the formBackingObject is called again which performs the default search, before onSubmit then gets called to perform the specific search.
Should I be using something other than AbstractFormController?
Apr 8th, 2008, 10:51 AM
Well, I've probably committed some kind of hienous technical crime, but I solved my problem by doing the following...
(a) stopped it being a session form - it wasnt helping, so no point.
(b) formBackingObject now calls onSubmit if !isFormSubmission() with the default parameters.
(c) onSubmit puts all the report results into the session
The but I'm unhappy about is that onSubmit puts things into the session. I would have liked to avoid that, but I couldnt see how my formBackingObject could display the default report unless I did that.