"How can I extend or write a more dynamic navigation in JSF? for example to create dynamic parameters or calls to a non jsf pages with GET parameters?"
Ok, here's how I solved this. In the method of the backing bean that will be called when I the button is pressed I added this code:
FacesContext currentInstance = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) currentInstance.getExternalContext().getResponse();
HttpServletRequest request = (HttpServletRequest) currentInstance.getExternalContext().getRequest();
String url = request.getContextPath();
if (a == 1) {
url += "testpage.jsp?arg1=1&arg2=2";
} else {
url += "testpage2.jsp?arg1=1&arg2=3";
}
response.sendRedirect(url);
currentInstance.responseComplete();
As you can see here the solution it's very simple and works very well.
3 comments:
Thanks for the tip, this saved my ass :)
you're welcome.
Post a Comment