I am using Spring 2.5.x to develop a small Application.
The application retreives a number of records from a database with Hibernate.
This records are shown in a web page with a link to another web page where it should be able to change a specific record.
When I klick on the link to change a specific record a new page is shown with the specific record.
In this page I change data for a specific field and click on a Submit button.
My controller (SimpleFormController) will be executed and the formbackingobject method will be executed.
After that onSubmit method will be executed but it the new entered data will not be sent to onSubmit method.
Instead the old data will be send to this method.
Simply you didn't do it correctly on the next step, there are a lot of work that you need to do here.
1. Put "projectId" in the session.
2. Passing "projectId" in the jsp page that you have the data to edit.
3. Create a new controller to handle the edit process
4. Whatever the next step you like to do from here...
Hope it help....
"Your life is in your hands, to make of it what you choose."
Joined: Nov 24, 2008
Well the source code I give to you is the Controller that should handle the update.
The JSP page I have posted is the update page - this JSP page should handle the update.
I'm a newbie at Spring therefore my questions.
When I cklick on the Submit button on the web page (see JSP page in this thread) the onSubmit method will be called but the new entered value will not be sent to that method!
I don't know what you mean by putting projectID in the session.
When the JSP page listed in this thread (updateProject.jsp) will be called it receives a projectID and the formBackingObject method will be called.
Joined: Apr 13, 2011
I see your update controller code, it's not done correctly. You need a good reference or tutorial to walk you through here...
Basically you need to do several things in order to get an updated data on the next page.
1. Passing "projectId" in param or any way you know how to the request in your first page.
(This is where you've missed)
2. Put "projectId" in the session in the controller where it handle the submit form and set all updated value on the object you want to update
3. Retrieve "projectId" in your update controller and retrieve all the value from an object where you have saved set earlier, and set to the instance variables. Next pass it or set to an object you want to update.
4. On your JSP update page retrieve all updated value from an object that you set in an instance variables.
5. On submit you're done.
Hope it help...
Joined: Nov 24, 2008
I have solved this problem. I had different versions of spring.jar and spring-web.jar.
Everything works as expected!