PrettyFaces

Simple, effective, bookmark, JSF

PrettyFaces is an OpenSource extension for JSF1.2 and JSF2.0, which enables creation of bookmark-able, pretty URLs. PrettyFaces solves this problem elegantly, including features such as: page-load actions, seam-less integration with faces navigation, dynamic view-id assignment, and managed parameter parsing. And configuration-free compatibility with other JSF frameworks.

Downloads: ↓ (LGPL3)

1.2.4_GA: jar, src, api

2.0.1_GA: jar, src, api

All Downloads / Maven Repo

Dependencies:

J2EE5 and JSF1.2 or 2.0
commons-beanutils.jar (1.x)
commons-digester.jar (1.8)
commons-collections.jar (2.x)
commons-logging.jar (1.1.x)

Coming soon:

Global pattern-based URL actions, improved patterns

PrettyFaces requires separate downloads of dependencies. Also, we encourage feedback for all of our products, so please, if you have questions, concerns, suggestions, or other ramblings - email the user-group, or open an issue.


Subscribe to prettyfaces-users



View the documentation or FAQ.

From @ocpsoft and @lincolnthree


Features:

  1. Replace jsf views (/faces/page.jsf) with pretty URLS (/mapped/page): The client browser never sees your JSF View ID
  2. De-coupling, separation of URL and View ID. Now with dynamic view ID mapping (through El method expressions) you can show different pages based on runtime conditions.
  3. Page load actions call one or more actions before rendering a view.
  4. Managed parameter parsing: HTTP parameters parsed from URLs are stored in managed beans for easy access from other Java classes, simply get a reference to your parameter bean and you have full access to your HTTP parameters.
  5. Navigation by ID: Define your view IDs in one place, reference them easily in action-methods and components
  6. Easy to configure. Requires only one consolidated XML configuration file.

What makes PrettyFaces different:

Read the full article, here.

View the Documentation here.


FAQ:

  1. Q. Why do my Tomohawk / MyFaces components, or other 3rd party addons, break when I use PrettyFaces?

    A. Since PrettyFaces intercepts mapped HttpRequests then forwards those requests to JSF, it is necessary to enable any additional filters between PrettyFaces and JSF to listen to Servlet Forwards. This is done in the web.xml deployment descriptor by adding the following dispatcher elements to any needed Filters:

    For example:

    	<filter-mapping>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<url-pattern>/*</url-pattern>
    		<dispatcher>FORWARD</dispatcher>
    		<dispatcher>REQUEST</dispatcher>
    	</filter-mapping>
  2. Q. Why, when using MyFaces, am I getting a NullPointerException when I try to use normal faces-navigation?

    A. Some MyFaces versions do not completely comply with the JSF specification, thus the ViewRoot is null when the request is processed. There is a patch-workaround, here, which can be added to fix this issue. You must add this ViewHandler to your faces-config.xml.

  3. Q. Can I configure PrettyFaces via Annotations?

    A. No - this is not currently supported, but if someone wants to submit a patch, we’ll be more than happy to discuss your design.

  4. Q. How do I enable logging, so that I can tell what the heck is really going on?

    A. Create or update your log4j.properties file with the following values:

    ### direct log messages to stdout ###
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.Target=System.out
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
     
    log4j.rootLogger=warn, stdout
     
    ### Log for OcpSoft
    log4j.logger.com.ocpsoft=info
  5. Q. Can I map and process URLs that span a dynamic number of ‘/’ characters?

    A. Yes, please read section 3.4 of the docs, here.

  6. Q. How do I save FacesMessage objects after performing a redirect or pretty:redirect?

    A. You need to configure the optional MultiPageMessagesSupport PhaseListener (or something like it)

    	<?xml version='1.0' encoding='UTF-8'?>
    <faces-config 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-facesconfig_2_0.xsd"
    	version="1.2">
    	<lifecycle>
    		<phase-listener>
    			com.ocpsoft.pretty.application.MultiPageMessagesSupport
    		</phase-listener>
    	</lifecycle>
    </faces-config>

    See this article for a full explanation of how this works.


             
RSS