Prettyfaces + Primefaces

Splash Forums PrettyFaces Users Prettyfaces + Primefaces

This topic contains 6 replies, has 2 voices, and was last updated by  Anglo 2 years, 7 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #25668

    Anglo
    Participant

    Hi,

    I’m using Primefaces 3.4.2 and Prettyfaces-jsf2 3.3.3 but prettyfaces doesn’t work with me. any help would be appreciated

    web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
         <context-param>
            <param-name>com.ocpsoft.pretty.CONFIG_FILES</param-name>
            <param-value>/WEB-INF/pretty-config.xml</param-value>
        </context-param>
    
        <context-param>
            <param-name>javax.faces.PROJECT_STAGE</param-name>
            <param-value>Development</param-value>
        </context-param>
        <context-param>
            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
            <param-value>client</param-value>
        </context-param>
        <context-param>
            <param-name>javax.faces.CONFIG_FILES</param-name>
            <param-value>/WEB-INF/faces-config.xml</param-value>
        </context-param>
        
           
        <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>/news/*</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>/welcome.html</welcome-file>
        </welcome-file-list>
        
        <context-param>
            <param-name>primefaces.THEME</param-name>
            <param-value>bootstrap</param-value>
        </context-param>
     
           
    
        <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>
    
    </web-app>
    

    when I type the following in the browser
    http://localhost:8082/myapp/login
    I got the error message HTTP status 404
    The requested resource (/myapp/login) is not available.
    but, when I type the following in the browser, it works
    http://localhost:8082/myapp/news/app/login.xhtml

    #25669

    Anglo
    Participant

    faces-config.xml

    
    <navigation-rule>
            <description>Navigation for the header.</description>
            <from-view-id>/*</from-view-id>
    
            <navigation-case>
                <from-outcome>login</from-outcome>
                <to-view-id>/app/login.xhtml</to-view-id>
                <redirect/>
            </navigation-case>
    ..............
    
    #25670

    Anglo
    Participant

    pretty-config

      
        <url-mapping id="home" > 
            <pattern value="/" /> 
            <view-id value="/index.xhtml" />
        </url-mapping> 
        <url-mapping id="login" > 
            <pattern value="/login" /> 
            <view-id value="/app/login.xhtml" />
        </url-mapping> 
               
    </pretty-config>
    
    #25672

    If your URL is:

    http://localhost:8082/myapp/news/app/login.xhtml

    Then you will have to set the view-id to this:

    <view-id value="/news/app/login.xhtml" />

    instead of this:

    <view-id value="/app/login.xhtml" />

    Could you give it a try?

    BTW: You are using an old version of PrettyFaces. PrettyFaces is now part of Rewrite. Have a look at this URL to learn how to setup the new version:

    http://ocpsoft.org/prettyfaces/

    #25675

    Anglo
    Participant

    Still it’s not working !!!

    
    .........................
         
        <url-mapping id="home" > 
            <pattern value="/" /> 
            <view-id value="/news/index.xhtml" />
        </url-mapping> 
          
          
        <url-mapping id="login" > 
            <pattern value="/login" /> 
            <view-id value="/news/app/login.xhtml" />
        </url-mapping> 
               
    </pretty-config>
    #25676

    Does PrettyFilter start up correctly? You should see a corresponding entry in the logs.

    #25679

    Anglo
    Participant

    Problem fixed and the reason was that pretty-config.xml was placed in /WEB-INF/lib/ instead of /WEB-INF
    Thanks Chris for your help

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

You must be logged in to reply to this topic.

Comments are closed.