Problems with 3.1.0

Splash Forums PrettyFaces Users Problems with 3.1.0

This topic contains 6 replies, has 3 voices, and was last updated by  oprisa_vlad 11 years, 2 months ago.

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



    I am trying to follow the documentation steps to integrate prettyfaces in my webApp using prettyfaces-jsf12-3.1.0.jar.


    in web.xml the first filter

    <filter-name>Pretty Filter</filter-name>

    <filter-name>Pretty Filter</filter-name>

    in pretty-config.xml

    <pretty-config xmlns=""

    <url-mapping id="home">
    <pattern value="/home"/>

    in faces-config.xml


    in my UrlBean i have

    String appName = "demo"
    public String getHomeViewId() {
    String rst = "/" + appName + "/pages/test/Home.jsf";
    System.out.println("- verify " + rst);
    return rst;

    I was so surprised to spend a lot of time for nothing…

    The main problem is that i get a HTTP Status 404 – /demo/home page when i provide the

    “http://localhost:8080/demo/home” url.

    With log on debug i get

    10:57:32,875 DEBUG PrettyFilter:66 - Character encoding: null
    10:57:32,890 DEBUG PrettyFilter:66 - Character encoding: null
    10:57:32,968 DEBUG PrettyFilter:66 - Character encoding: null
    11:06:52,953 DEBUG PrettyFilter:66 - Character encoding: null
    11:06:52,953 DEBUG PrettyFilter:66 - Character encoding: null
    - verify /demo/pages/test/Home.jsf
    11:06:52,953 DEBUG PrettyFilter:66 - Character encoding: UTF-8

    If I check with the “unpretty” faces url works just fine.

    If I set /demo/pages/test/Home.jsf in pretty-cofig.xml <view-id> tag works just fine but it’s not what i wanted.

    So … could anyone tell me what i’ve done wrong???

    Thanks in advance.

    PS: Forgot to mention that initially i started with ocpsoft-pretty-faces-1.1.3.jar that worked just fine until i needed

    return “pretty:”

    Now this works but i’m left without dynamic view-id.

    There are no left-over jar’s in my project and I tripple-checked the configuration.


    Is demo the context path of your webapp? In that case you won’t need to add demo in front of the view id in your getHomeViewId() method as the view id is expected to be relative to the context path.



    I realize now that i did not explain myself in a complete manner.

    The main concept is to have MyDemo.ear (meening MyDemo as a contextPath).

    This app will have more that one View (User interface), just like skins but more custom and not css made, having same jsp file structure.

    Each module will be named




    so the directory structure of my web (directory) is






    so in the url i will want


    to be managed according to appName variable (demo1, demo2 … demoN)

    (The ambiguity in my first post was that demo (contextpath) and demo as a directory name were the same.)

    so the

    <pattern value=”/home”/>

    considering the relative path i want it to be

    String rst = “/” + appName + “/pages/test/Home.jsf”;


    http://localhost:8080/MyDemo / demo1 /pages/test/Home.jsf

    After more digging my friend found a workaround:

    String rst = “/faces/” + appName + “/pages/test/Home.jsp”;

    to be cautgh by the second filter


    <servlet-name>Faces Servlet</servlet-name>



    <!– this one –>


    <servlet-name>Faces Servlet</servlet-name>



    I had declared both in my web.xml file.

    I don’t find this normal. Am I wrong ?

    Also if anybody can provide me with a link on how to use prettyfaces to do something like this:


    first request: ../siteCase/value1/value2


    <url-mapping id=”siteCase”>

    <pattern value=”/siteCase”/#{viewBean.value1}/#{viewBean.value2}>



    public String getSiteCase() {

    String rst = “pretty:home”;

    if (loggedIn) {

    rst = “/” + appName + “/pages/test/SiteCase.jsf”;

    } else {

    //here i save the this.desiredUrl

    rst = “pretty:login”;


    return rst;



    He is not logged in and will be redirected to the login page


    He passes login and i want to redirect him to the UrlBean.this.desiredUrl

    My problem is that i don’t know how to save this.desiredUrl (and also “parameters”) and how to redirect

    public String login(){

    //login stuff

    return “pretty:???”;//and the parameters ?


    Thanks in advance!


    It seems like the dynaview is not working correctly if you are using an extension-based mapping for the FacesServlet. That’s very strange. Could you try to use .xhtml instead of .jsf in your dynaview? Perhaps this will help.

    Regarding your login page: You could either save the original URL by writing it to a query parameter or you could temporarily save it in the session. I personally would prefer the first option. This would look something like this:

    <url-mapping id="login">
    <pattern value="/login">
    <query-param name="url"> #{loginBean.redirectUrl} </query-param>

    In your UrlBean:

    public String getSiteCase() {
    if (loggedIn) {

    // ..

    } else {

    // set value of the query parameter
    loginBean.setRedirectUrl( request.getRequestURI() );

    // perform the redirect. The query parameter value will
    // be read from the loginBean
    return "pretty:login";


    This way you will have the correct URL in the LoginBean and can directly send a redirect in case of a successful login.

    Here are some relevant references to the documentation regarding this:


    Hey guys, I looked into the DynaView engine and in order to tell what’s wrong, I need to know which page is not found.

    From what you’ve posted so far, it seems like the DynaView method is actually being called just fine. Since your ‘verify – url’ System.out.println() statement does appear.

    This makes me think that there’s something else wrong, but without a closer look, it will be hard to tell.

    If you could step-debug through com.ocpsoft.pretty.faces.event.PrettyPhaseListener (line 113 – in processDynaView()) – and see what’s actually going on for us, that would help a lot.

    Either that or set your log level to TRACE, and see what the DynaView engine tells you is going on:

    log.trace("Invoking DynaView method: " + viewId);
    log.trace("Forwarding to DynaView: " + viewId);




    Ah, I should have said if you could post the TRACE logs here that would be great :)



    Ok, no problem Lincoln. I will reconfigure the test case and i will post whe result.

    Just that I am currently going out of town for 2 days (national hollyday, barbecues and stuff :P) and i will post in like … 48 hours.

    Thanks verry much Christian for the help and references.

    Hope u don’t mind the delay…

    Best regards guys!

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

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.