[solved] Action error in pretty config xml

Splash Forums PrettyFaces Users [solved] Action error in pretty config xml

This topic contains 5 replies, has 3 voices, and was last updated by  Christian Kaltepoth 7 years, 5 months ago.

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

    smooth4me
    Participant

    Hi,

    Just now I installed Pretty faces in my application. I am configuring pretty config xml I was getting the following error:

    cvc-complex-type.2.4.a: Invalid content was found starting with element ‘query-param’. One of ‘{“http://ocpsoft.com/prettyfaces/3.1.0”:action}’ is expected.
    [/CODE]

    and my code is

    [CODE]
    <pretty-config xmlns=”http://ocpsoft.com/prettyfaces/3.1.0″
    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
    xsi:schemaLocation=”http://ocpsoft.com/prettyfaces/3.1.0
    http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.1.0.xsd“>

    <url-mapping>
    <pattern value=”/faces/userHome” />
    <view-id>/faces/user/userHome.faces</view-id>
    <action>#{dashboardBean.handleReorder}</action>
    <query-param name=”page”>#{dashboardBean.page}</query-param>
    </url-mapping>

    </pretty-config>
    [/CODE]

    Thanks for your help in advance.

    [CODE]

    cvc-complex-type.2.4.a: Invalid content was found starting with element ‘query-param’. One of ‘{“http://ocpsoft.com/prettyfaces/3.1.0”:action}’ is expected.

    [/CODE]

    and my code is

    <pretty-config xmlns=”http://ocpsoft.com/prettyfaces/3.1.0″
    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
    xsi:schemaLocation=”http://ocpsoft.com/prettyfaces/3.1.0
    http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.1.0.xsd“>

    <url-mapping>
    <pattern value=”/faces/userHome” />
    <view-id>/faces/user/userHome.faces</view-id>
    <action>#{dashboardBean.handleReorder}</action>
    <query-param name=”page”>#{dashboardBean.page}</query-param>
    </url-mapping>

    </pretty-config>
    [/CODE]

    Thanks for your help in advance.

    [CODE]

    <pretty-config xmlns=”http://ocpsoft.com/prettyfaces/3.1.0″

    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”

    xsi:schemaLocation=”http://ocpsoft.com/prettyfaces/3.1.0

    http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.1.0.xsd“>

    <url-mapping>

    <pattern value=”/faces/userHome” />

    <view-id>/faces/user/userHome.faces</view-id>

    <action>#{dashboardBean.handleReorder}</action>

    <query-param name=”page”>#{dashboardBean.page}</query-param>

    </url-mapping>

    </pretty-config>

    [/CODE]

    Thanks for your help in advance.

    #20164

    query-param should be placed immediately after pattern if I am not mistaken. Your code should still work, but it won’t validate unless the elements are in the right order.

    #20165

    smooth4me
    Participant

    Hi,

    Thanks it worked. I am not getting the expected url. I was expecting

    http://localhost:8080/mhealth250/faces/userHome?page=userHome

    but I got the following url http://localhost:8080/mhealth250/faces/userHome.

    and my configuration is

    <pretty-config xmlns=”http://ocpsoft.com/prettyfaces/3.1.0″

    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”

    xsi:schemaLocation=”http://ocpsoft.com/prettyfaces/3.1.0

    http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.1.0.xsd“>

    <url-mapping>

    <pattern value=”/faces/userHome” />

    <query-param name=”page”>#{dashboardBean.page}</query-param>

    <view-id>/faces/user/userHome.faces</view-id>

    </url-mapping>

    </pretty-config>

    Thanks for your help in advance.

    #20166

    How is the URL being accessed?

    #20167

    smooth4me
    Participant

    Hi,

    In the following way url being accessed.

    http://localhost:8080/mhealth250/faces/userHome

    Thanks,

    #20168

    This is expected behavior in this situation! When you access /mhealth250/faces/userHome with your browser, PrettyFaces will write the value of the page query parameter to the specified bean property. But as you don’t specified this query parameter, PrettyFaces will just render you view /faces/user/userHome.faces.

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

You must be logged in to reply to this topic.

Comments are closed.