h:commandLink has stoped working after adding prettyfaces

Splash Forums PrettyFaces Users h:commandLink has stoped working after adding prettyfaces

This topic contains 2 replies, has 2 voices, and was last updated by  javi2ee 2 months, 3 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #27399

    javi2ee
    Participant

    Hi, I’ve added PrettyFaces to an application and everything is working as expected except for one thing.

    First of all the project is based on:
    JSF2.2(Primefaces 5.3)
    Wildfly-9.0.2
    SpringSecurity 3.2

    The problem is that all commandlinks that worked previously have stopped doing so, I’ve updated the action values so if it was

    <h:commandLink value="go" 
    action="/os/compras/proveedor/List.xhtml?faces-redirect=true/>

    now it’s

    <h:commandLink value="go" 
    action="/compras/proveedores?faces-redirect=true/>

    having in my pretty-config a tested working mapping:

    <url-mapping  id="proveedores">
    		<pattern value="/compras/proveedores" />
    		<view-id value="/os/compras/proveedor/List.xhtml" />
    	</url-mapping>

    The form get submitted and a browser refresh/redirect occurs but to the same page where the commandLink get invoked.
    I’ve tried action=”/compras/proveedores” and the original action value too without success.

    There is not any error in log and I can’t figure what is failing here, I attach a file with web.xml, and pretty-config.xml for if relevant.

    Thanks for your help.

    EDIT:

    After posting the web.xml I’ve noticed that the project was on production stage, after changing it to development i’m getting a faces message:

    Can not find the event ID matching navigation view ‘ /os/dashboard.xhtml ‘ for the { 1} ‘ with the result ‘ {2 } action ‘

    being /os/dashboard.xhtml the page not ‘pretty-faced'(I mean the real/original page), where i invoke the commandLink.

    Sorry for possible grammar or spelling mistakes

    • This topic was modified 2 months, 3 weeks ago by  javi2ee.
    • This topic was modified 2 months, 3 weeks ago by  javi2ee.
    • This topic was modified 2 months, 3 weeks ago by  javi2ee.
    • This topic was modified 2 months, 3 weeks ago by  javi2ee.
    #27405

    You don’t need to change the action of your commandLinks. So something like this should work:

    <h:commandLink value="go" action="/os/compras/proveedor/List.xhtml?faces-redirect=true/>
    

    The action attribute must always refer to the view id and NOT to the pretty URL.

    But please note that creating such commandLinks is bad practice as it creates a postback followed by a redirect to the new page. The postback is unnecessary. Just use h:link instead which will create a standard HTML link to the new page:

    <h:link outcome="/os/compras/proveedor/List.xhtml">go</h:link>
    

    Back to your original problem. Could you please check your dependencies? Make sure you have the rewrite-integration-faces module in your dependencies. This one is required for the JSF integration.

    #27406

    javi2ee
    Participant

    Hi Christian, I’m using commandLink because actually it’s invoking a managed bean that return a dynamic navigation case and is also performing other operations, in my previous message I gave a simplified example of the case to abstract the problem, but thank you for the tip, I didn’t know it.

    The original problem has been solved after adding that dependencie and changing the bean to return the view id, thank you very much,
    I really appreciate your help.
    Regards

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

You must be logged in to reply to this topic.

Comments are closed.