spring mvc- form submit back button

2019-08-05 05:07发布

问题:

I have a simple jsp form (page1.jsp)that allows the user to enter a bunch of textboxes. The submit button posts the form and displays page2 On Page2- there is a tab called Page1- on clicking this tab, the user should be able to view page1 with all the information that he entered, so that he can edit it ,if he chooses to.

I have my controller set up for the first part page1- page2, working correctly. However I am not sure how to implement the second part page2 ->page 1. I am unable to show the filled out form from the previous page.

I am not very proficient in Spring MVC and would appreciate some guidance.

Thanks

回答1:

You can do this using two approaches . if you wish to use @ModelAttribute annotation and spring:form tags. you can use the form backing option to remember the values in the page.

  1. Spring MVC example
  2. Spring Form handling

or you can do them in the native session handling .put your data to the session and then retrieve them when you go the prev page

Hope this helps !