java - Spring SimpleFormController onSubmit request parameters -


I am using SimpleFormController in my application to handle form submisions. One thing that I am missing is the request object which has passed onSubmit (request, response ..) is different from the initial request object which is received by formBackingObject (..) Happens . Obviously because this is the new request from the web once again.

I want to use the same parameters from the requested object in submit (..) formBackingObject (..) .

It may be possible that I can collect them from the hidden areas by jossi, but I am trying to get some elegant perspectives.

Is there any way to do this?

Edit:

I'm overriding

  formBackingObject (HTTPSArlet Request) ` 

and

<<>

Methods in my class.

> Formbacking object (..) will be called for intent view and I will have some variables from the request object if the user forms If I am called onsmember (..) , then I have another request that is different from the object which I received in formbackingObject (..) .

What I am asking, is there any way to catch the initial 'request' parameter (like request.getParameter () ), so that I can use them You can send onsite (..) to send them back & amp; Through hidden areas? '

formBackingObject () The method is being called when the user starts the initial form Requests for the scene. This is a completely different HTTP request when a user submits the form on which the onsmitt () method is called.

If you want to save the state with the first HTTP request, it is available in another HTTP request, your best option is to save it in an HTTP session.

Example: In your formBackingObject () method:

  http session session = request.getSession (); Session.setAttribute ("param1", request.getParameter ("param1")); Session.setAttribute ("Ultimate 2", request.getParameter ("param2"));  

and your onSubmit () method:

  http session session = request.getSession (); String Param 1 = (string) session.getAttribute ("param1"); String param2 = (string) session.getAttribute ("param2");  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -