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 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 :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With