view-id is getting ignored and everything gets redirected to my "welcome-file"

Splash Forums PrettyFaces Users view-id is getting ignored and everything gets redirected to my "welcome-file"

This topic contains 9 replies, has 3 voices, and was last updated by  tiagoperes 8 years, 7 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • #24111


    I discovered PrettyFaces today, it seems just what I need to fix my ugly URLs in my JSF project. Unfortunately I passed my entire day in this and I can’t get it to work. My first problem I described in this topic. To fix this I used the following dependency, instead of the ones in the tutorial:


    I don’t know if it’s correct to use this dependency with my version of JSF (Mojarra 2.1.22), maybe this is causing the problem I’ll describe below.

    As the tutorial says, I added the filter in my web.xml and created a configuration file. Something bizarre happens: it doesn’t matter what I write in the “view-id” tag, every URL I declare redirects to the same page: the one I defined in my web.xml as the welcome file, through the tag <welcome-file>. I’m new to Prettyfaces and I tried everything I could already. Can someone help me?

    Thanks in advance for any answer.

    My web.xml and configuration file are attached.

    • This topic was modified 8 years, 7 months ago by  tiagoperes.

    Hi! Sorry for the confusion. Please see my response on your other thread, but version 2.0.4 of PrettyFaces is over three years old! You should really use version 2.0.2.Final of Rewrite, using the PrettyFaces configuration module – this is the most up-to-date version.

    THe versions may be confusing, but Rewrite is a newer framework, and PrettyFaces is now a part of that. All releases of PrettyFaces going forward are done as a release of Rewrite.

    You can see all released artifacts here:

    Version 2.0.2.Final was just released tonight, and should be sync’d to Maven central within an hour or two. (Until then, you can use 2.0.1.Final, following the instructions on

    Sorry for the mess; hopefully this helps to explain it.




    Thank you for answering Lincoln. I updated my dependencies to “rewrite-servlet 2.0.2.Final” and “rewrite-config-prettyfaces 2.0.2.Final”. I also removed the PrettyFaces filter from my web.xml, now there’s nothing concerning Prettyfaces in this file. My pretty-config.xml continues under the WEB-INF folder.

    When I initialize my application, the only log I get from Prettyfaces is:

    Jun 06, 2013 2:29:52 PM org.ocpsoft.rewrite.faces.RewritePhaseListener
    INFO: RewritePhaseListener starting up

    None of my mapping works, I get error 404 every time I try to access a URL that doesn’t correspond to a JSF view-id.

    The pages are correctly loaded when I access the URLs directly (/faces/page.xhtml). I thought that, maybe, Prettyfaces was not loading pretty-config.xml, I tried to specify the config file in my web.xml through the parameter “com.ocpsoft.pretty.CONFIG_FILES”, but it didn’t work.

    I also tried this in 2.0.1.Final, I had the same problem.

    My mapping file is attached to the original post.



    Maybe my problem is the same described here:

    I’m also uploading my web.xml.

    • This reply was modified 8 years, 7 months ago by  tiagoperes.

    Hmmm… do you not see anything about RewriteFilter starting up? There should be quite a big set of logs. Could you perhaps upload a sample project that reproduces this so that I can try to debug it? I’m guessing it’s just something simple that is mis-configured, but it’s not clear until I can see the whole app.

    Thanks! Sorry you are having trouble.



    Ok, I created a new application, with only JSF and Prettyfaces as dependencies. I still have the same problem, I must be missing something…

    My complete log file for the sample application:

    Jun 06, 2013 4:31:16 PM org.apache.catalina.startup.HostConfig deployDescriptor
    INFO: Deploying configuration descriptor C:\Users\Tiago Peres\AppData\Roaming\NetBeans\7.3\apache-tomcat-\conf\Catalina\localhost\sample.xml
    Jun 06, 2013 4:31:16 PM com.sun.faces.config.ConfigureListener contextInitialized
    INFO: Inicializando Mojarra 2.1.22 ( 20130508-2000 para o contexto '/sample'
    Jun 06, 2013 4:31:17 PM com.sun.faces.spi.InjectionProviderFactory createInstance
    INFO: JSF1048: Anotações PostConstruct/PreDestroy presentes.  Os métodos ManagedBeans marcados com essas anotações informarão as anotações processadas.
    Jun 06, 2013 4:31:17 PM org.ocpsoft.rewrite.faces.RewritePhaseListener
    INFO: RewritePhaseListener starting up.
    Jun 06, 2013 4:31:17 PM org.apache.catalina.util.LifecycleBase start
    INFO: The start() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/sample]] after start() had already been called. The second call will be ignored.

    My sample application has:

    • pom.xml
    • META-INF/context.xml
    • WEB-INF/web.xml
    • WEB-INF/pretty-config.xml
    • index.jsp

    I’m annexing all of these files to this post (unless index.jsp, due to the limit of 4 annexes per post).

    I saw an example of web.xml for Prettyfaces including the RewriteFilter, for what you said before it’s not necessary, but I tried it anyway, when I do it, I get a lot of log from Prettyfaces, although it still doesn’t work.


    You can also attach a ZIP of everything, but I will try to put that together 🙂



    Lincoln, have u find anything wrong with my code? Thank you for taking your time to help me.

    I’m annexing the zip file to make things easier.


    The problem is your web.xml:

    <web-app version="3.0" ....metadata-complete="true">

    Setting metadata-complete to true will tell the servlet container to ignore the web-fragment.xml that’s located in the Rewrite archive. You should either set it to false or remove it (the default is false).



    Thank you very much Christian! That was exactly the problem. I don’t know why Netbeans set this to true by default…

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

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

Comments are closed.