Frustrated trying to get PrettyFaces up and running for the first time.

Splash Forums PrettyFaces Users Frustrated trying to get PrettyFaces up and running for the first time.

This topic contains 9 replies, has 3 voices, and was last updated by  harrykap 6 years, 1 month ago.

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

    harrykap
    Participant

    I am a newbie to both JSF and PrettyFaces so am much appreciative of any help extended. I have trying for some hours now to get URL rewriting to work to no avail. I keep getting 404 errors when I try to access the rewritten url.

    I have simple JSF page at http://localhost:8080/faces/one.xhtml which I am trying to get to at http://localhost:8080/store.

    I am running Glassfish 3.3 with Net Beans as my IDE on a Windows 7 box.

    I’ve tried the following two filter entries in web.xml

    =======================================================

    <filter>

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

    <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>

    <async-supported>true</async-supported>

    </filter>

    <filter-mapping>

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

    <url-pattern>/*</url-pattern>

    <dispatcher>REQUEST</dispatcher>

    <dispatcher>FORWARD</dispatcher>

    <dispatcher>ASYNC</dispatcher>

    <dispatcher>ERROR</dispatcher>

    </filter-mapping>

    =======================================

    <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>

    =====================================================

    Below is my entry in pretty-config.xml (in the WEB-INF directory)

    <url-mapping id=”store”>

    <pattern value=”/store/” />

    <view-id value=”/faces/one.xhtml” />

    </url-mapping>

    I have the following jars in my library path

    prettyfaces-jsf2.3.3.0.jar

    common-beanutils-1.8.3.jar

    commons-collections-2.1.1.jar

    commons-digester-2.1.jar

    commons-logging-1.1.1.jar

    I am using JEE 6

    Again any help is appreciated

    #21243

    Based on what you’ve pasted, it looks like you probably get 404 errors on both pages?

    Don’t you need a context path? (Unless you have already removed it via settings in GlassFish)

    http://localhost:8080/{context-path}/faces/one.xhtml

    http://localhost:8080/{context-path}/store

    That may be your issue. If it is not, we will keep trying to figure it out for you :)

    #21244

    Also, you should not need to add anything to web.xml if you are using JavaEE 6 or (Servlet 3.0+)

    #21245

    Also, you do not need any apache jars. PrettyFaces JAR is standalone.

    #21246

    harrykap
    Participant

    I did originally have a context path, http://localhost:8080/SandBox. I changed it to “/” while I was trying to figure out the problem. When I had the context path I also tried the below which didn’t work either.

    <url-mapping id=”store”>

    <pattern value=”/store/” />

    <view-id value=”/SandBox/faces/one.xhtml” />

    </url-mapping

    In either case

    /localhost:8080/SandBox/faces.one.xhtml works for SandBox

    and /localhost:8080/faces/one.xhtml works for “/” as the context path

    /localhost:8080/store does not work in both cases.

    I also tried web.xml with and without the filter declaration.

    Appreciating your effort

    -Harry

    #21247

    harrykap
    Participant

    Also, I added the apache jars because of the following in the documentation.

    “Non-Maven Users must also include the following required JAR dependencies (downloaded separately) in addition to the PrettyFaces JAR file:

    *commons-beanutils.jar (1.x)

    *commons-digester.jar (2.x)

    *commons-collections.jar (2.x)

    *commons-logging.jar (1.1.x)

    #21248

    Ok, I’ll fix those docs. (Could you post the set you were using just in case?)

    It also looks like you might have a very simple issue going on. I noticed that your mapping uses:

    <pattern value="/store/" />

    But your URL in the browser has no trailing slash:

    /localhost:8080/store

    Could you try with:

    /localhost:8080/store/

    Also, if this does not work, could you post a sample application so I can take a look?

    Thanks,

    Lincoln

    #21249

    domdorn
    Participant

    please try

    <url-mapping id=”store”>

    <pattern value=”/store/” />

    <view-id value=”/one.xhtml” />

    </url-mapping>

    or

    <url-mapping id=”store”>

    <pattern value=”/store/” />

    <view-id value=”/faces/one.xhtml” />

    </url-mapping>

    #21250

    harrykap
    Participant
    #21251

    harrykap
    Participant

    I used Domdorn’s xml and made sure I had a “/” at the end of the url when I entered it into the browser and things are working now.

    Thank you for the help.

    -harrykap

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

You must be logged in to reply to this topic.

Comments are closed.