Search code examples
jsf-2primefacesprettyfaces

how use primefaces and prettyfaces together?


Primefaces doesn't work when primefaces and pretty face use together. I add flowing jar:

prettyfaces-jsf2-3.3.3.jar
primefaces-4.0-20130605.174828-3.jar

My web.xml code:

<filter>
    <filter-name>Pretty Filter</filter-name>
    <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
</filter>

<filter-mapping> 
    <filter-name>Pretty Filter</filter-name> 
    <url-pattern>/*</url-pattern> 
    <dispatcher>FORWARD</dispatcher> 
    <dispatcher>REQUEST</dispatcher> 
    <dispatcher>ERROR</dispatcher>
</filter-mapping> 

My pretty-config.xml code:

<rewrite match="^[^(/primefaces_resource/)|^(javascript)]" trailingSlash="append"  toCase="lowercase" redirect="301"/>
<url-mapping id="home"> 
    <pattern value="/" /> 
    <view-id value="/" />
</url-mapping> 

This image is whithou prittyface( jar and configure): enter image description here

when I add pretty face jar .then flowing view: enter image description here

I want to change the url.

example:

  (http://localhost:8084/AntSchoolMS/faces/index.xhtml)

I want it to be changed as

(http://localhost:8084/AntSchoolMS/)

please help me .


Solution

  • I use primefaces 3.5 with pretty faces 3.3.3 and works ok. The configuration in your web.xml seems to be ok. Make sure you place pretty-config.xml also in WEB-INF. About the pretty-config you posted: it doesn't make any sense to have a url-mapping where the pattern and the view-id are the same, so remove it. Also I don't have that rewrite rule, I have several mappings like the folowing:

    <url-mapping id="login">
        <pattern value="/login/">
        <view-id value="/login.jsf" />
    </url-mapping>
    

    Did you try removing that rewrite rule to see what happens?