I have two pages (AllUsersList.xhtml, ActiveUserList.xhtml) which shares the same code. The body of the page contains links that navigate to different page that in turn contains links to all Users. If I start from AllUsersList.xhtml, after viewing all the inner pages it should return back to AllUsersList.xhtml. The same action should be done for ActiveUserList.xhtml. When I come back from inner pages every page expects a param to land on the appropriate page.
We use the "from" page parameter to identify, whether we need to go back to AllUsersList.xhtml or ActiveUserList.xhtml. Both the pages contain a List's rendered in a rich:dataTable, but whenever I navigate to the ViewUser.xhtml page and come back, I loose the reference to the "from" parameter and hence it goes to the wrong target page.
Should I pass "from" parameter to ViewUser.xhtml also to resolve this issue O开发者_运维百科R is there a better way to handle page parameters when the end user navigates to more inner pages.
If all you want is the ability to return back after viewing an inner page (back button), you may consider using a history.back :
<a href="javascript:void(0);" onclick="history.back(); return false;">Back</a>
Or you can pass the parameter on each page through the visit.
You may also consider using a cookie to save the source page, rather than passing a parameter on numerous pages. When a source page is visited, it would save the parameter to a cookie, and all other pages render using that value in the cookie, if it exists.
精彩评论