Navigation using path parameter on Pretty Faces 2.0.8.Final

Splash Forums PrettyFaces Users Navigation using path parameter on Pretty Faces 2.0.8.Final


This topic contains 5 replies, has 3 voices, and was last updated by  Lincoln Baxter III 7 years, 11 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #25820

    Daniel Camargo

    Consider the configuration below:

    @URLMapping(id = “programaManter”, parentId = “homeTreinamento”, pattern = “/programa/#{id :}”, viewId = “/pages/treinamento/ProgramaManter.xhtml”)

    Lets say that I need to navigate to **/programa/1**. I’ve tried the following:

    return “/pages/treinamento/ProgramaManter.xhtml?faces-redirect=true&id=” + id;

    But instead of navigating to **/programa/1** it’s navigating to **/programa/?id=1**, how can I force it to build the url using path parameter instead of query parameter?


    Hey Daniel,

    I just had a look at your sample project. The problem is that you have two mapping for /pages/Second.xhtml:

    @URLMappings(mappings = {
      @URLMapping(id = "secondCreate", pattern = "/second", viewId = "/pages/Second.xhtml"),
      @URLMapping(id = "secondUpdate", pattern = "/second/#{id :}", viewId = "/pages/Second.xhtml")

    Now if you return something like this:

    return "/pages/Second.xhtml?faces-redirect=true&id=" + id;

    PrettyFaces basically search for a mapping with a matching view id. In your case the first mapping which such a view id is secondCreate. And as there is no id parameter in this parameter, it is added as a query parameter.

    To work around that you could use a PrettyFaces navigation string like this: = 1;
    return "pretty:secondUpdate";

    This way you can tell PrettyFaces exactly which mapping to use for the redirect. With such an navigation outcome will extract the values directly from your bean properties to build the URL. So it is important to set the ID correctly.

    I hope this helps.



    Daniel Camargo

    You were right, PrettyFaces gets the first mapping fo the list. I’ve changed the order of the mappings and it’s working now.

    Thank you!


    Gah! Sorry for the delay. I was trying to buy a house. I also had trouble running yoru example. Which server did you use? I got this on JBoss AS7 and was unsure of how to resolve it:

    15:15:37,992 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 71) Critical error during deployment: : com.sun.faces.config.ConfigurationException: The tag named passThroughAttribute from namespace has a null handler-class defined
    	at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processHandlerClass( [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2]
    	at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTags( [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2]
    	at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTagLibrary( [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2]
    	at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.process( [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2]
    	at com.sun.faces.config.ConfigManager.initialize( [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2]
    	at com.sun.faces.config.ConfigureListener.contextInitialized( [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2]
    	at org.apache.catalina.core.StandardContext.contextListenerStart( [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
    	at org.apache.catalina.core.StandardContext.start( [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
    	at [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
    	at$000( [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
    	at$ [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
    	at java.util.concurrent.Executors$ [rt.jar:1.7.0_21]
    	at java.util.concurrent.FutureTask$Sync.innerRun( [rt.jar:1.7.0_21]
    	at [rt.jar:1.7.0_21]
    	at java.util.concurrent.ThreadPoolExecutor.runWorker( [rt.jar:1.7.0_21]
    	at java.util.concurrent.ThreadPoolExecutor$ [rt.jar:1.7.0_21]
    	at [rt.jar:1.7.0_21]

    Yeah, I also ran into this. The project includes Mojarra as a compile scoped dependency. And including it in the WAR causes this exception on Wildfly. Changing the scope to provided fixed the problem for me.


    Interesting. I’ve opened JIRA issue about this:

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.