Question

I am trying the prettyfaces library for REST url mapping to JSF2 pages.

I first set up prettyfaces in maven's pom.xml:

<dependency>
           <groupId>com.ocpsoft</groupId>
           <artifactId>prettyfaces-jsf2</artifactId>
           <version>3.3.3</version>
        </dependency>

Then my pretty-config.xml:

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

    <url-mapping id="view-marchi">
        <pattern value="/marchi/{urlMarchio}" />
        <view-id value="/marchio.xhtml" />
    </url-mapping>

</pretty-config>

I have a marchio.xhtml in my webapp root folder. It's working directly accessed: www..com/marchio.xhtml.

However the mapping doesn't work as I expected:

www..com/marchi/testparam

404 - Not found!

I don't get the point... am I doing something wrong? Or maybe there's something misconfigured..?

Was it helpful?

Solution

I believe the parameters in the mapping have to match #{param-name}. As I can see, you have missed the #. Change your pattern in the url-mapping to:

<pattern value="/marchi/#{urlMarchio}" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top