纯JSP页面导航的最佳实践? [英] Pure JSP page navigation best practice?
问题描述
在Web应用程序的各个JSP页面之间实现导航链接的最佳方法是什么?
What's the best way I can implement navigation links between various JSP pages of my Web app?
假设我有一个显示项目列表的list.jsp
.然后,用户单击这些项目之一以在view.jsp
中查看该项目的更多详细信息.现在,我需要一个从view.jsp
到list.jsp
的链接.但是,list.jsp
不是唯一包含view.jsp
链接的页面.例如,也可以从search.jsp
转到view.jsp
.除此之外,每个list.jsp
和search.jsp
可能具有不同的参数和属性,这些参数和属性会影响它们产生的输出.
Suppose that I have a list.jsp
that shows a list of items. Then the user clicks on one of these items to view the item in more details in view.jsp
. Now I need a link from view.jsp
back to list.jsp
. However, list.jsp
is not the only page that contains a link to view.jsp
. For example, it is possible to go to view.jsp
, from search.jsp
as well. Besides that, each of list.jsp
and search.jsp
might have different parameters and attributes that affect the output they produce.
此刻,我已经使用名为source
的参数以一种简单明了的方式实现了该功能,该参数显示了用户单击以转到当前页面的页面,并在要记住的页面之间传递了其他参数或属性.但是,我认为可能存在以纯 JSP + Servlet 方式实现这种功能的最佳实践,我想在继续之前先询问一下.
At the moment I have implemented this in a straightforward way using a parameter called source
that shows the page that the user has clicked to go to the current page and by passing other parameters or attributes between the page to be remembered. However, I thought there might be a best practice for implementing this sort of functionality in a pure JSP+Servlet way and I wanted to ask about this before I proceed.
谢谢.
推荐答案
您应该检查发布/重定向/获取网页设计模式,这可能有助于您了解如何在Web应用程序上创建良好的导航系统以及如何处理背面: )
You should check post/redirect/get webdesign pattern it may help you to know how to create a good navigation system on your webapp and how to handle the back :)
这篇关于纯JSP页面导航的最佳实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!