URL Parameters get lost when switching to new jsf Page

Splash Forums PrettyFaces Users URL Parameters get lost when switching to new jsf Page

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

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #17783

    jens-it
    Participant

    Hello all!

    I have a simple JSF-Page with a command link:

    <h:commandLink action="pretty:startPage" value="Go home">
    <f:param name="param1" value="#{testBean.param1}" />
    </h:commandLink>

    in my pretty-config.xml I define the navigation:

    <url-mapping id="startPage">
    <pattern value="/start" />
    <query-param name="param1">#{testBean2.result}</query-param>
    <view-id>/testPage.jsf</view-id>
    </url-mapping>

    The new site “testPage.jsf” is rendered correctly but without any parameter in the URL. what am I missing? When I have a link pointing to the same page where the link is located it works.

    #20174

    So you’re saying that this works?

    <h:commandLink action="testPage.jsf" value="Go home">
    <f:param name="param1" value="#{testBean.param1}" />
    </h:commandLink>

    But this does not?

    <h:commandLink action="pretty:startPage" value="Go home">
    <f:param name="param1" value="#{testBean.param1}" />
    </h:commandLink>

    Which version of PrettyFaces are you using? Which version of JSF?

    #20175

    jens-it
    Participant

    The following code works as espected but points to the same jsf page as the link is placed on:

    <h:commandLink action="pretty:startPage" value="Go home">
    <f:param name="param1" value="#{testBean.param1}" />
    </h:commandLink>

    <url-mapping id="startPage">
    <pattern value="/start" />
    <query-param name="param1">#{testBean2.result}</query-param>
    <view-id>/mainPage.jsf</view-id>
    </url-mapping>

    The link is located on the page mainPage.jsf.

    JSF-Version: 1.2 (Mojarra)

    PrettyFaces: 3.1.0

    #20176

    domdorn
    Participant

    What are you expecting the URL to be?

    Please provide a testcase with input values and expected output.

    In the meantime, you might want to try with

    <pattern value=”/start/#{param1}” />

    #20177

    jens-it
    Participant

    I expect the URL to be: http://localhost:8080/application/start?param1=one+value

    “one value” is first read from the #{testBean.param1} in the command link.

    Then it is put into the URL and also in the managed bean #{testBean2.result}

    within the pretty faces url-mapping.

    The solution: <pattern value=”/start/#{param1}” /> does not work, an exception is thrown:

    “Exception occurred while building URL for MappingId < startPage >, Required value < #{param1} > was null”

    #20178

    Is this project something that you could send to us? It would probably be very easy to figure out if we can take a look.

    Based on the errors you’re seeing, my initial recommendation would be to make sure that your Mapping actually matches your JSF Beans names and parameter values, that your beans have appropriately named getters and setters, and that the values are not being cleared out before the render_response phase.

    If you can’t send your project, if possible, could you create a small 1-page test application that you could share with us?

    This functionality is working in our regression-test applications.

    Thanks,

    #20179

    Otherwise, try to paste as much relevant code in here as possible :)

    #20180

    jens-it
    Participant

    unfortunately I cannot share the project. (i will build a small project next week)

    I have tested several times now, and sometimes it works, sometimes it does not work. I also checked the names of the Beans and their properties, which seems correct.

    I’m defining my beans with Spring, with the @Controller annotation. Is there a known problem regarding this? (spring 3)

    Thanks,

    Jens

    #20181

    No known problems, but I’m looking forward to seeing what’s going on in your case.

    Thanks a lot. Sorry you’re having so much trouble. It’s not supposed to be this hard :)

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

You must be logged in to reply to this topic.

Comments are closed.