Spring MVC-表单提交后退按钮 [英] spring mvc- form submit back button

查看:101
本文介绍了Spring MVC-表单提交后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的jsp表单(page1.jsp),允许用户输入一堆文本框.提交按钮发布表单并显示page2 在第2页上,有一个称为第1页的选项卡,单击此选项卡,用户应该能够查看第1页及其输入的所有信息,以便他可以编辑(如果愿意).

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.

我为第一部分page1- page2设置了控制器,并且工作正常. 但是,我不确定如何实现第二部分的页面2->页面1.我无法显示上一页中填写的表单.

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.

我不太精通Spring MVC,希望能获得一些指导.

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

谢谢

推荐答案

您可以使用两种方法来做到这一点.如果您希望使用@ModelAttribute批注和spring:form标记.您可以使用表单后备选项来记住页面中的值.

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 例子
  2. Spring表单处理
  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

希望这会有所帮助!

这篇关于Spring MVC-表单提交后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆