Struts 2:重定向操作?从一页到另一页然后再返回
我有一个 jsp 页面,有一个提交按钮。该按钮与另一个 jsp 页面链接。
因此,假设我的 stuts 文件如下所示:
B.jsp
现在页面“A.jsp”上的提交按钮会将我带到 B.jsp。这有效。问题是我想要执行以下操作:
按页面 A.jsp 上的提交按钮,转到 B.jsp ,我将再次按按钮并返回到 A.jsp 。问题是页面 B.jsp 会转到很多页面,因此 B.jsp 必须知道按下提交按钮时哪个页面会将我带回,在本例中又是 A.jsp。
简而言之,B.jsp 必须知道我来自哪个页面,以便我可以通过按提交按钮再次返回(这可能是一个将再次发送回 A.jsp 的参数,但不会目前确实很重要)
A.jsp -> B.jsp-> jsp C.jsp-> B.jsp-> jsp
i have a jsp page that has a submit button. This button is linked with another jsp page.
So lets assume my stuts file looks like this:
B.jsp
So now the submit button being on page "A.jsp" will take me to B.jsp. This works. The problem is that i want to do the following:
press on the submit button on page A.jsp , go to B.jsp where i will press again a button and go back to A.jsp . The problem is that to page B.jsp go many pages, so B.jsp has to know when pressing the submit button to which page will take me back , in this case A.jsp again.
So in a few words, B.jsp has to know from which page i came from so that i can go back again by pressing a submit button (this could be a parameter that would be sent back to A.jsp again, but does not really matter at the current point)
A.jsp -> B.jsp -> A.jsp
C.jsp -> B.jsp -> C.jsp
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜您的
B.jsp
是某种通用结果页面,它显示一条消息并邀请用户返回到提交之前的上一页。如果您不想使用 javascript 读取浏览器历史记录(我不想),标准方法是将“returnUrl”作为 Action 的属性传递。这对我来说似乎很简单。I guess your
B.jsp
is some sort of general result page, which displays a message and invites the user to return to the previous page -before the submission. If you dont want to read the browser history with javascript (I woudn't) the standard approach is to pass the "returnUrl" as a property of your Action. This seems straighforward to me.