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 6 years, 2 months ago.

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

    RedShadow
    Participant

    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/” />

    <view-id>#{userSessionBean.getAdminViewPath}</view-id>

    </url-mapping>

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

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

    <view-id>#{userSessionBean.hacking}</view-id>

    <action>#{userSessionBean.checkAuthorizationAndLoginRedirect}</action>

    <action>#{navigationBean.getViewPath}</action>

    </url-mapping>

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

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

    <view-id>#{userSessionBean.hacking}</view-id>

    <action>#{userSessionBean.checkAuthorizationAndLoginRedirect}</action>

    <action>#{navigationBean.getViewPath}</action>

    </url-mapping>

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

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

    <view-id>#{userSessionBean.hacking}</view-id>

    <action>#{userSessionBean.checkAuthorizationAndLoginRedirect}</action>

    <action>#{navigationBean.getViewPath}</action>

    </url-mapping>

    #21191

    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?

    ~Lincoln

    #21192

    RedShadow
    Participant

    I am using 3.3.0 latest snapshot through maven dependency.

    <dependency>

    <groupId>com.ocpsoft</groupId>

    <artifactId>prettyfaces-jsf2</artifactId>

    <version>3.3.0-SNAPSHOT</version>

    </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 :(

    #21193

    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?

    Thanks,

    Lincoln

    #21194

    You could try 3.3.1-SNAPSHOT

    #21195

    RedShadow
    Participant

    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.

    SEE: http://code.google.com/p/prettyfaces/issues/detail?id=117

    #21196

    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 />

    </url-mapping>`

    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> –>

    </url-mapping>`

    Hope this helps :)

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

You must be logged in to reply to this topic.

Comments are closed.