Sms Kopex
Sms Kopex

Reputation: 223

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 .

Upvotes: 4

Views: 5846

Answers (3)

Lincoln
Lincoln

Reputation: 3191

Additionally, I would recommend upgrading to the latest version of PrettyFaces - see http://ocpsoft.org/prettyfaces/

Upvotes: 0

I've been using these two for some time and they are working as expected. My project used the 3.5 version of primefaces and PrettyFaces 3.3.3.

In my web.xml I did not need to register any filter like you did.

I would also try to remove the rewrite rule as Damian suggests.

Upvotes: 1

damian
damian

Reputation: 4044

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?

Upvotes: 2

Related Questions