This content has been marked as final.
Show 3 replies
-
1. Re: Dynamic navigation
susnet Jul 12, 2007 11:13 PM (in response to susnet)I almost succeeded in solving this problem with this code:
@In private FacesContext facesContext; public void navigate () { String page = "/pages/articles/xyz.xhtml"; // This could be any page, collected from database UIViewRoot root = facesContext.getApplication ().getViewHandler ().createView (facesContext, page); try { facesContext.getApplication ().getViewHandler ().renderView (facesContext, root); } catch (IOException ioe) { log.error (ioe); } }
But I also get an IllegalStateException, so I guess this is not the right way of doing this.ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:404)
I have also tried this code:@In private Renderer renderer; public void navigate () { String page = "/pages/articles/xyz.xhtml"; renderer.render (page); }
but it just gives me NPE.
Any help would really be appreciated! -
2. Re: Dynamic navigation
matt.drees Jul 13, 2007 12:22 AM (in response to susnet)You might look at the code in RenderNavigationHandler and NavigationHandler; it might give you some ideas.
-
3. Re: Dynamic navigation
susnet Jul 13, 2007 8:11 AM (in response to susnet)Thank you very much! This code solved the problem:
String page = "/pages/articles/xyz.xhtml"; RenderNavigationHandler navHandler = new RenderNavigationHandler(page, null, null); navHandler.navigate (FacesContext.getCurrentInstance ());