开发者

Pure JSP page navigation best practice?

What's the best way I can implement navigation links between various JSP pages of my Web app?

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开发者_JAVA技巧 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.

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.

Thanks in advance.


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 :)


Why don't you use a stack Behrang? I mean create some stack for each user in their sessions and every time he navigates to a new page, put it in the stack. Pop when he wanted to go back.


You can store from attribute which is storing page name from where you are going and put that in go back link.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜