Form action is not rewritten correctly?

Splash Forums PrettyFaces Users Form action is not rewritten correctly?

This topic contains 6 replies, has 2 voices, and was last updated by  Lincoln Baxter III 10 years, 5 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #18001


    When i make a call to, let’s say /admin/test/ and the rendered view is located in /admin/modules/test/test.xhtml then the problem occurs.

    The form which is on the view gets the action with the value “/admin/modules/test/test.xhtml” instead of “/admin/test/”.

    Is there any solution or have i forgotten something?

    The rules:

    <!– Only append slash if the request does not look like an file request–>

    <rewrite match=”^((?!.*.w*).)*$” trailingSlash=”append” toCase=”lowercase”/>

    <!– This rule is for the login page to display the value of the substitute attribute in the form action –>

    <rewrite match=”^/admin/login.xhtml$” substitute=”/admin/” inbound=”false”/>

    <rewrite match=”^/admin/admin.xhtml$” substitute=”/admin/” inbound=”false”/>

    <url-mapping id=”cmsStart”>

    <pattern value=”/admin/” />



    <url-mapping id=”menue” parentId=”cmsStart”>

    <pattern value=”#{menueEntryName : navigationBean.menueEntryName}/” />





    <url-mapping id=”menueSecondLevel” parentId=”menue”>

    <pattern value=”#{secondLevelMenueEntryName : navigationBean.secondLevelMenueEntryName}/” />





    <url-mapping id=”menueParameters” parentId=”menueSecondLevel”>

    <pattern value=”#{ /.*/ parameters : navigationBean.parameters}/” />






    I’m guessing this is because you are using Dynamic View-IDs, which only support outbound-rewriting since veresion 3.3.0 — If you are not using 3.3.0, please upgrade.

    Which version of PrettyFaces are you using?




    I am using 3.3.0 latest snapshot through maven dependency.






    I also tried to implement a custom processor for the rewrite rule but with using the redirected_from attribute of the servletrequest i broke everything. I have no clue on how to do that :(


    I would not use the SNAPSHOT, just 3.3.0.

    But it sounds like it may not work there either if it’s broken in SNAPSHOT. So, do you think you could create a test application that shows the problem so I can take a look?




    You could try 3.3.1-SNAPSHOT



    Still not working, seems like dyna views are not rewritten correctly. I tried it now with 3.3.1-SNAPSHOT, 3.3.0-SNAPSHOT and 3.3.0

    I will setup a test project and open an issue if you can not give me a solution.



    Ok good news; I figured out the cause of your issue.

    You’re not actually using DynaView in your project:

    `<url-mapping id=”menue” parentId=”start”><br />

    <pattern value=”#{menueEntryName : testBean.menueName}/” /><br />

    <view-id value=”/empty.xhtml”></view-id><br />

    <action>#{testBean.getViewPath}</action><br />


    You are just calling an action method and returning a navigation case, at which point JSF renders that view, but it cannot change the form URL because the form URL does not exist in any url-mapping!

    You need to do this instead:

    `<url-mapping id=”menue” parentId=”start”>

    <pattern value=”#{menueEntryName : testBean.menueName}/” />

    <view-id value=”#{testBean.getViewPath}”></view-id>

    <!– Notice that the method ID is in place of the ViewId – this is how DynaView works. You’ll no longer need an action unless you want to rum some code when the page is accessed. <action>#{testBean.getViewPath}</action> –>


    Hope this helps :)

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

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

Comments are closed.