In my web application, where presentation tier is in JSF, i want to have button 'back to previous page' on some pages.
I'm making it through URL parameters:
http://www.example.com/index.xhtml?backurl=value
for example, in mange bean i set current page A.xhtml url:
public String showCourse(Course c){
currentCourse = c;
String currentUrl = FacesContext.getCurrentInstance().getViewRoot().getViewId();
return "/B.xhtml?faces-redirect=true&backurl=" + currentUrl;
}
and at B.xhtml (with url http://www.example.com/A.xhtml?backurl=A.xhtml
)
i have
<h:button value="Back to previous page" outcome="#{backurl}"/>
which redirect me to previous page.
Everything works fine, but the problem is when i redirect from B.xhtlm page to C.xhtml page. I set backurl
url parameter again. After go to C.xhtml page and come back to B.xhtml i lose previous backurl
parameter - when i click to button i don't come back to A.xhtml page but to C.xhtml :(
Do you know beter why to do this ?