<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>OcpSoft &#187; PrettyFaces</title> <atom:link href="http://ocpsoft.com/tags/prettyfaces/feed/" rel="self" type="application/rss+xml" /><link>http://ocpsoft.com</link> <description>&#34;Simple Software&#34;</description> <lastBuildDate>Tue, 27 Jul 2010 15:07:50 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0</generator> <item><title>Calling All PrettyFaces Users!</title><link>http://ocpsoft.com/prettyfaces/calling-all-prettyfaces-users/</link> <comments>http://ocpsoft.com/prettyfaces/calling-all-prettyfaces-users/#comments</comments> <pubDate>Sun, 30 Aug 2009 16:41:17 +0000</pubDate> <dc:creator>Lincoln</dc:creator> <category><![CDATA[PrettyFaces]]></category> <category><![CDATA[Java]]></category> <category><![CDATA[JSF]]></category><guid
isPermaLink="false">http://ocpsoft.com/?p=70</guid> <description><![CDATA[Are you using PrettyFaces on a project you can share about? Looking for real-world experiences: How has PrettyFaces helped you or your team? What would you change if you could (you can)? If you would like to share, show us your work of art! Email to: lincoln@ocpsoft.com Thank you! PS &#8211; In addition: If you&#8217;d [...]]]></description> <content:encoded><![CDATA[<h3>Are you using PrettyFaces on a project you can share about?</h3><p>Looking for real-world experiences:</p><ul><li>How has PrettyFaces helped you or your team?</li><li>What would you change if you could (you can)?</li><li>If you would like to share, show us your work of art!</li></ul><p>Email to: lincoln@ocpsoft.com</p><p>Thank you!</p><p>PS &#8211; In addition: If you&#8217;d like to be added to our new &#8220;People using PrettyFaces&#8221; page, also send a logo and a short description of your product or company!</p> ]]></content:encoded> <wfw:commentRss>http://ocpsoft.com/prettyfaces/calling-all-prettyfaces-users/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>PrettyFaces JSF1.1 UrlRewriting Support &#8211; Released</title><link>http://ocpsoft.com/prettyfaces/prettyfaces-jsf11-urlrewriting-support-released/</link> <comments>http://ocpsoft.com/prettyfaces/prettyfaces-jsf11-urlrewriting-support-released/#comments</comments> <pubDate>Mon, 24 Aug 2009 22:27:01 +0000</pubDate> <dc:creator>Lincoln</dc:creator> <category><![CDATA[PrettyFaces]]></category> <category><![CDATA[Releases]]></category> <category><![CDATA[Java]]></category> <category><![CDATA[JSF]]></category><guid
isPermaLink="false">http://ocpsoft.com/?p=68</guid> <description><![CDATA[PrettyFaces: A new version of PrettyFaces for JSF1.1 (historical support) is now available for download. This version is feature-complete, but we are looking for feedback on compatibility and functionality that may be broken with various implementations, so please post comments! It should be noted that JSF is now on version 2.0, and PrettyFaces 2.0.x should [...]]]></description> <content:encoded><![CDATA[<h3><a
href="http://ocpsoft.com/prettyfaces">PrettyFaces</a>:</h3><p>A new version of PrettyFaces for JSF1.1 (historical support) is now available for download. This version is feature-complete, but we are looking for feedback on compatibility and functionality that may be broken with various implementations, so please post comments!<br
/> <span
id="more-68"></span></p><p>It should be noted that JSF is now on version 2.0, and PrettyFaces 2.0.x should be used. E.g: PrettyFaces 1.2.x should be used with JSF 1.2.</p><p
style="padding-left: 30px;"><strong>1.1.0:</strong> <a
href="http://prettyfaces.googlecode.com/files/ocpsoft-pretty-faces-1.1.0.jar">jar</a>, <a
href="http://prettyfaces.googlecode.com/files/ocpsoft-pretty-faces-1.1.0-sources.jar">src</a></p><div
style="align:center; background:#555; padding:10px"><form
action="http://groups.google.com/group/prettyfaces-users/boxsubscribe"><table
border="0" cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td
colspan='2' align="center"><strong>Subscribe to <a
href="http://groups.google.com/group/prettyfaces-users">prettyfaces-users</a></strong></td></tr><tr><td
align="right" width="30%"><label
for="subeml2" style="color:#eee">Email:&nbsp;</label></td><td
align="left"> <input
id="subeml2" name="email" size="18" type="text" /> <input
name="sub" type="submit" value="Subscribe" /></td></tr></tbody></table></form></div><p><br/></p> ]]></content:encoded> <wfw:commentRss>http://ocpsoft.com/prettyfaces/prettyfaces-jsf11-urlrewriting-support-released/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>PrettyFaces 1.2.4_GA and 2.0.1_GA Released</title><link>http://ocpsoft.com/prettyfaces/prettyfaces-124_ga-and-201_ga-released/</link> <comments>http://ocpsoft.com/prettyfaces/prettyfaces-124_ga-and-201_ga-released/#comments</comments> <pubDate>Sat, 13 Jun 2009 17:12:03 +0000</pubDate> <dc:creator>Lincoln</dc:creator> <category><![CDATA[PrettyFaces]]></category> <category><![CDATA[Releases]]></category> <category><![CDATA[JSF]]></category><guid
isPermaLink="false">http://ocpsoft.com/?p=59</guid> <description><![CDATA[PrettyFaces: New versions of PrettyFaces for JSF1.2 and JSF2.0 are now available for download: 1.2.4_GA: jar, src 2.0.1_GA: jar, src Minor Release: 20090613 Fixed non-redirecting faces-navigation integration. Enhanced null handling for mis-configured viewIds Now supports browsers with cookies disabled Subscribe to prettyfaces-users Email:&#160;]]></description> <content:encoded><![CDATA[<h3><a
href="http://ocpsoft.com/prettyfaces">PrettyFaces</a>:</h3><p>New versions of PrettyFaces for JSF1.2 and JSF2.0 are now available for download:<br
/> <span
id="more-59"></span></p><p
style="padding-left: 30px;"><strong>1.2.4_GA:</strong> <a
href="http://prettyfaces.googlecode.com/files/ocpsoft-pretty-faces-1.2.4_GA.jar">jar</a>, <a
href="http://prettyfaces.googlecode.com/files/ocpsoft-pretty-faces-1.2.4_GA-sources.jar">src</a></p><p
style="padding-left: 30px;"><strong>2.0.1_GA:</strong> <a
href="http://prettyfaces.googlecode.com/files/ocpsoft-pretty-faces-2.0.1_GA.jar">jar</a>, <a
href="http://prettyfaces.googlecode.com/files/ocpsoft-pretty-faces-2.0.1_GA-sources.jar">src</a></p><p>Minor Release: 20090613</p><ol><li>Fixed non-redirecting faces-navigation integration.</li><li>Enhanced null handling for mis-configured viewIds</li><li>Now supports browsers with cookies disabled</li></ol><div
style="align:center; background:#555; padding:10px"><form
action="http://groups.google.com/group/prettyfaces-users/boxsubscribe"><table
border="0" cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td
colspan='2' align="center"><strong>Subscribe to <a
href="http://groups.google.com/group/prettyfaces-users">prettyfaces-users</a></strong></td></tr><tr><td
align="right" width="30%"><label
for="subeml2" style="color:#eee">Email:&nbsp;</label></td><td
align="left"> <input
id="subeml2" name="email" size="18" type="text" /> <input
name="sub" type="submit" value="Subscribe" /></td></tr></tbody></table></form></div><p><br/></p> ]]></content:encoded> <wfw:commentRss>http://ocpsoft.com/prettyfaces/prettyfaces-124_ga-and-201_ga-released/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>PrettyFaces 1.2.3_GA Released</title><link>http://ocpsoft.com/releases/prettyfaces-123_ga-released/</link> <comments>http://ocpsoft.com/releases/prettyfaces-123_ga-released/#comments</comments> <pubDate>Wed, 15 Apr 2009 04:58:46 +0000</pubDate> <dc:creator>Lincoln</dc:creator> <category><![CDATA[Releases]]></category> <category><![CDATA[Java]]></category> <category><![CDATA[JSF]]></category> <category><![CDATA[OpenSource]]></category> <category><![CDATA[PrettyFaces]]></category><guid
isPermaLink="false">http://ocpsoft.com/?p=53</guid> <description><![CDATA[PrettyFaces: Version 1.2.3_GA: binary, source, documentation (stable) Minor Release: 20090415 Added optional &#60;action onPostback=&#8221;false&#8221;&#62; boolean flag to prevent action methods from being called on form postback. Defaults to true; Added optional &#60;query-param decode=&#8221;false&#8221;&#62; to prevent java.net.URLDecode.decode() from being called on a specific managed query-parameter. Defaults to true; Added unit tests for several critical classes. Minor [...]]]></description> <content:encoded><![CDATA[<h3><a
href="http://ocpsoft.com/prettyfaces">PrettyFaces</a>:</h3><p><strong>Version 1.2.3_GA</strong>: <a
href="http://prettyfaces.googlecode.com/files/ocpsoft-pretty-faces-1.2.3_GA.jar">binary</a>, <a
href="http://prettyfaces.googlecode.com/files/ocpsoft-pretty-faces-1.2.3_GA-sources.jar">source</a>, <a
href="http://ocpsoft.com/prettyfaces/v123">documentation</a> (stable)<br
/> Minor Release: 20090415</p><ol><li>Added optional &lt;action onPostback=&#8221;false&#8221;&gt; boolean flag to prevent action methods from being called on form postback. Defaults to true;<li>Added optional &lt;query-param decode=&#8221;false&#8221;&gt; to prevent java.net.URLDecode.decode() from being called on a specific managed query-parameter. Defaults to true;<li>Added unit tests for several critical classes.<li>Minor to moderate refactoring of PrettyFilter/PrettyContext</ol><div
style="align:center; background:#555; padding:10px"><form
action="http://groups.google.com/group/prettyfaces-users/boxsubscribe"><table
border="0" cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td
colspan='2' align="center"><strong>Subscribe to <a
href="http://groups.google.com/group/prettyfaces-users">prettyfaces-users</a></strong></td></tr><tr><td
align="right" width="30%"><label
for="subeml2" style="color:#eee">Email:&nbsp;</label></td><td
align="left"> <input
id="subeml2" name="email" size="18" type="text" /> <input
name="sub" type="submit" value="Subscribe" /></td></tr></tbody></table></form></div><p><br/></p> ]]></content:encoded> <wfw:commentRss>http://ocpsoft.com/releases/prettyfaces-123_ga-released/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>PrettyFaces v1.2.3_RC2 Released</title><link>http://ocpsoft.com/prettyfaces/prettyfaces-v123_rc2-released/</link> <comments>http://ocpsoft.com/prettyfaces/prettyfaces-v123_rc2-released/#comments</comments> <pubDate>Wed, 01 Apr 2009 01:21:25 +0000</pubDate> <dc:creator>Lincoln</dc:creator> <category><![CDATA[PrettyFaces]]></category> <category><![CDATA[Java]]></category> <category><![CDATA[JSF]]></category> <category><![CDATA[OpenSource]]></category> <category><![CDATA[Releases]]></category><guid
isPermaLink="false">http://ocpsoft.com/?p=49</guid> <description><![CDATA[PrettyFaces: Version 1.2.3_RC2: binary, source, documentation (stable) Minor Release: 20090331 Servlet forwards are working Subscribe to prettyfaces-users Email:&#160;]]></description> <content:encoded><![CDATA[<h3><a
href="http://ocpsoft.com/prettyfaces">PrettyFaces</a>:</h3><p><strong>Version 1.2.3_RC2</strong>: <a
href="http://prettyfaces.googlecode.com/files/ocpsoft-pretty-faces-1.2.3_RC2.jar">binary</a>, <a
href="http://prettyfaces.googlecode.com/files/ocpsoft-pretty-faces-1.2.3_RC2-sources.jar">source</a>, <a
href="http://ocpsoft.com/prettyfaces/v123">documentation</a> (stable)<br
/> Minor Release: 20090331</p><ol><li>Servlet forwards are working</li></ol><div
style="align:center; background:#555; padding:10px"><form
action="http://groups.google.com/group/prettyfaces-users/boxsubscribe"><table
border="0" cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td
colspan='2' align="center"><strong>Subscribe to <a
href="http://groups.google.com/group/prettyfaces-users">prettyfaces-users</a></strong></td></tr><tr><td
align="right" width="30%"><label
for="subeml2" style="color:#eee">Email:&nbsp;</label></td><td
align="left"> <input
id="subeml2" name="email" size="18" type="text" /> <input
name="sub" type="submit" value="Subscribe" /></td></tr></tbody></table></form></div><p><br/></p> ]]></content:encoded> <wfw:commentRss>http://ocpsoft.com/prettyfaces/prettyfaces-v123_rc2-released/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>PrettyFaces v1.2.3_RC1 Released</title><link>http://ocpsoft.com/releases/prettyfaces-v123_rc1-released/</link> <comments>http://ocpsoft.com/releases/prettyfaces-v123_rc1-released/#comments</comments> <pubDate>Thu, 19 Mar 2009 12:20:00 +0000</pubDate> <dc:creator>Lincoln</dc:creator> <category><![CDATA[Releases]]></category> <category><![CDATA[Java]]></category> <category><![CDATA[JSF]]></category> <category><![CDATA[OpenSource]]></category> <category><![CDATA[PrettyFaces]]></category><guid
isPermaLink="false">http://ocpsoft.com/?p=47</guid> <description><![CDATA[PrettyFaces: Version 1.2.3_RC1: binary, source, documentation (stable) Minor Release: 20090319 Managed query-params now accept multiple parameters of the same name: E.g.: String[] names &#8212; would accept a list of parameters (with the same name) from the request Enhanced configuration loading &#8212; PrettyFaces now looks for /META-INF/pretty-config.xml by default, in addition to accepting a comma-separated list [...]]]></description> <content:encoded><![CDATA[<h3><a
href="http://ocpsoft.com/prettyfaces">PrettyFaces</a>:</h3><p><strong>Version 1.2.3_RC1</strong>: <a
href="http://prettyfaces.googlecode.com/files/ocpsoft-pretty-faces-1.2.3_RC1.jar">binary</a>, <a
href="http://prettyfaces.googlecode.com/files/ocpsoft-pretty-faces-1.2.3_RC1-sources.jar">source</a>, <a
href="http://ocpsoft.com/prettyfaces/v123">documentation</a> (stable)<br
/> Minor Release: 20090319</p><ol><li>Managed query-params now accept multiple parameters of the same name: E.g.: String[] names &#8212; would accept a list of parameters (with the same name) from the request</li><li>Enhanced configuration loading &#8212; PrettyFaces now looks for /META-INF/pretty-config.xml by default, in addition to accepting a comma-separated list of user config-files in the web.xml init param: com.ocpsoft.pretty.CONFIG_FILES &#8212; submitted by Aleksei Valikov</li><li>JSP support for standard attributes on the pretty:link tag has been fixed. The pretty link will now accept style=&#8217;mystyle&#8217; and other attributes &#8212; from <a
href="http://ocpsoft.com/about">Derek Hollis at OcpSoft</a></li></ol><div
style="align:center; background:#555; padding:10px"><form
action="http://groups.google.com/group/prettyfaces-users/boxsubscribe"><table
border="0" cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td
colspan='2' align="center"><strong>Subscribe to <a
href="http://groups.google.com/group/prettyfaces-users">prettyfaces-users</a></strong></td></tr><tr><td
align="right" width="30%"><label
for="subeml2" style="color:#eee">Email:&nbsp;</label></td><td
align="left"> <input
id="subeml2" name="email" size="18" type="text" /> <input
name="sub" type="submit" value="Subscribe" /></td></tr></tbody></table></form></div><p><br/></p> ]]></content:encoded> <wfw:commentRss>http://ocpsoft.com/releases/prettyfaces-v123_rc1-released/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>PrettyFaces v1.1.x, v1.2.x, v2.0.x Docs (legacy)</title><link>http://ocpsoft.com/prettyfaces/v123/</link> <comments>http://ocpsoft.com/prettyfaces/v123/#comments</comments> <pubDate>Thu, 19 Mar 2009 04:40:03 +0000</pubDate> <dc:creator>Lincoln</dc:creator> <category><![CDATA[PrettyFaces]]></category> <category><![CDATA[Java]]></category> <category><![CDATA[JSF]]></category><guid
isPermaLink="false">http://ocpsoft.com/?p=43</guid> <description><![CDATA[Configuration Setting up PrettyFaces is simple. Configure PrettyFaces Filters in WEB-INF/web.xml Create the WEB-INF/pretty-config.xml file (Steps 1 &#38; 2 are required. Advanced features are optional.) Advanced Features Using dynamic view-ids Using the managed query-parameter facility Wiring navigation into JSF action methods Parsing complex / dynamic-length URLs Accessing PrettyContext through EL Components &#60;pretty:link&#62; &#60;pretty:urlbuffer&#62; Configuring Logging [...]]]></description> <content:encoded><![CDATA[<h1><a
name="configuration"></a>Configuration</h1><p>Setting up PrettyFaces is simple.<br
/> <span
id="more-43"></span></p><div
class="inset"><div
style="margin-left: 10px;"><ol><li><h4><a
href="#filters">Configure PrettyFaces Filters in	WEB-INF/web.xml</a></h4></li><li><h4><a
href="#prettyconfig">Create the WEB-INF/pretty-config.xml file</a></h4><p> (Steps 1 &amp; 2 are required. Advanced features are optional.)</p></li><li><h4><a
href="#application">Advanced Features</a></h4><ul><li><a
href="#dynamicviewid">Using dynamic view-ids</a></li><li><a
href="#queryparams">Using the managed query-parameter facility</a></li><li><a
href="#navigation">Wiring navigation into JSF action methods</a></li><li><a
href="#customparsing">Parsing complex / dynamic-length URLs</a></li><li><a
href="#elaccess">Accessing PrettyContext through EL</a></li></ul></li><li><h4><a
href="#links">Components</a></h4><ul><li><a
href="#prettylink">&lt;pretty:link&gt;</a></li><li><a
href="#urlbuffer">&lt;pretty:urlbuffer&gt;</a></li></ul></li><li><a
href="#logging">Configuring Logging (log4j)</a></li></ol><div
class="clearer"></div></div></div><div
class="featured"><div
class="inside"><p><span
style="color: red">Note:</span> This is not the <a
href="http://ocpsoft.com/prettyfaces/docs">current version</a> of PrettyFaces. This page is valid for the 1.1.0, 1.2.x, and 2.0.2 versions.</p></div></div><h3 style="margin-bottom: 15px;"><a
href="#configuration"><strong>0. Get PrettyFaces.</strong></a></h3><p>This step is pretty straight-forward, right? Extract necessary JAR files into your /WEB-INF/lib directory, or include a maven dependency in your pom.xml</p><div
class="wp_syntax"><div
class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #808080; font-style: italic;">&lt;!-- For JSF1.1 --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.ocpsoft<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>ocpsoft-pretty-faces<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.1.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #808080; font-style: italic;">&lt;!-- For JSF1.2 --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.ocpsoft<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>ocpsoft-pretty-faces<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.2.6_RC1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #808080; font-style: italic;">&lt;!-- For JSF2.0 --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.ocpsoft<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>ocpsoft-pretty-faces<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.0.2_GA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div><h3 style="margin-bottom: 15px;"><a
name="filters"></a><a
href="#configuration"><strong>1. Add the &lt;filter&gt; and &lt;filter-mapping&gt; to /WEB-INF/web.xml</strong></a></h3><p>PrettyFilter does most of the work. Without it, not much would happen.</p><div
class="wp_syntax"><div
class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Pretty Filter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.ocpsoft.pretty.PrettyFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Pretty Filter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dispatcher<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>REQUEST<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dispatcher<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dispatcher<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>FORWARD<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dispatcher<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dispatcher<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>ERROR<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dispatcher<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div><h3 style="margin-bottom: 15px;"><a
name="prettyconfig"></a><a
href="#configuration"><strong>2. Create the /WEB-INF/pretty-config.xml file</strong></a></h3><p>This is where you will map URLs to Faces Views. Read on for details.</p><div
class="wp_syntax"><div
class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pretty-config</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://ocpsoft.com/prettyfaces-xsd&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://ocpsoft.com/prettyfaces-xsd </span>
<span style="color: #009900;">	http://ocpsoft.com/xml/ns/prettyfaces/pretty-1.0.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-mapping</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;login&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> /login <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> /faces/login.jsf <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-mapping</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;home&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> /home <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;query-param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;displayWelcomeMessage&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>#{homeBean.displayWelcomeMessage}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/query-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> #{homeBean.getViewPath} <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-mapping</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;viewStory&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  /story/#{myBean.currentStoryId}/  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;query-param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;commentText&quot;</span> <span style="color: #000066;">decode</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>#{myBean.commentText}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/query-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> /faces/story/viewStory.jsf <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">onPostback</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>#{myBean.loadStory}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/action<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-mapping</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;viewComment&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> /story/#{myBean.currentStoryId}/#{myBean.commentId} <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/faces/story/comment.jsf<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>#{myBean.loadComment}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/action<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pretty-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div><h3>Url Mappings</h3><p>Each &lt;url-mapping id=&#8221;"&gt; must specify a unique id. And contains the following attributes and elements, in order:</p><ol><li><h4>&lt;pattern&gt;/blog/article/#{someBean.paramName}&lt;/pattern&gt;</h4><p>Specify the pattern for which this URL will be matched. This element is required, and has a multiplicity of 1 (only one)</p><p>Any EL expressions #{someBean.paramName} found within the pattern will be processed as value injections. The URL will be parsed and the value found at the location of the EL expression will be injected into the location specified in that EL expression. <i><span
style="color:red;">Note:</span> EL expressions will not match over the &#8216;/&#8217; character.</i></p><p>The pattern itself is compiled parsed as a <a
href="http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html">regular expression</a>, meaning that the actual URL matching can be as simple or as complex as desired.</p><p>If further custom URL parsing is required, it is recommended to do this manually via an Action Method: See <a
href="#customparsing">custom parsing</a>.</p></li><li><h4>&lt;query-param name=&#8221;key&#8221;&gt;#{someBean.queryParamValue}&lt;/query-param&gt;</h4><p>Defines a managed query parameter of the form http://site.com/url?<b>key=somevalue</b>, where if the parameter exists, the value will be injected into the specified managed bean. <i>This also handles JSF commandLink and AJAX &lt;f:param&gt; values.</i> This element is optional, and has a multiplicity of 0&#8230;N (zero or more)</p><p><i>Attributes:</i></p><ol><li><strong>name</strong> &#8212; String, required. This is the request value key</li><li><strong>decode</strong> &#8212; boolean, optional (default true), if set to false, this query-param will not be URLDecoded (see <a
href="http://java.sun.com/javase/6/docs/api/java/net/URLDecoder.html">java.net.URLDecoder</a>)</li></ol></li><li><h4>&lt;view-id&gt;#{someBean.methodName}&lt;view-id&gt;</h4><p>Specify the JSF ViewId displayed by this mapping, by either calling an el Method (must return an object for which the toString() method will return the view Id) or by returning a literal String value. This element is required, and has a multiplicity of 1 (only one)</p><p>The ViewId may be any resource located within the current Servlet Context: E.g. PrettyFaces can also forward to a non-Faces servlet.</p></li><li><h4>&lt;action&gt;#{someBean.methodName}&lt;/action&gt;</h4><p>Specify an action method to be called after URL parameters have been parsed and assigned into beans. This element has a multiplicity of 0&#8230;N (zero or more)</p><p><i>Attributes:</i></p><ol><li><p><strong>phaseId</strong> &#8212; String, optional (default RESTORE_VIEW) if set to a valid JSF PhaseId, the action will occur immediately before the specified Phase. (see <a
href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/event/PhaseId.html">javax.faces.event.PhaseId</a>)</p><p>Valid values for this attribute are: RESTORE_VIEW, APPLY_REQUEST_VALUES, PROCESS_VALIDATIONS,	UPDATE_MODEL_VALUES, INVOKE_APPLICATION, RENDER_RESPONSE, ANY_PHASE.<p> <strong><span
style="color: red">Note however</span></strong>, that if the phase does not occur, neither will your action method.</p></li><li><p><strong>onPostback</strong> &#8212; boolean, optional (default true), if set to false, this	action method will not occur on form postback. (see <a
href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/render/ResponseStateManager.html#isPostback(javax.faces.context.FacesContext)">ResponseStateManager.isPostback()</a>)</p></li></ol></li></ol><h3>Order of processing:</h3><ol><li>URL pattern parsing, query-parameter handling, and value injection into JSF managed beans.</li><li>View-Id calculation (if a view Id is dynamic, the el method	will be called.)</li><li>JSF gains control of the request via RequestDispatcher.forward(&#8220;/context/faces/viewId.jsf&#8221;).</li><li>Action methods are called before RESTORE_VIEW phase, unless the optional phaseId attribute is specified.</li></ol><h3>Config Loading:</h3><p>At application startup time, before any requests are processed, Pretty Faces processes zero or more configuration resources, located according to the following algorithm:</p><ol><li>Search for classpath resources named <span
class="code">META-INF/pretty-config.xml</span><br
/> in the ServletContext resource paths for this web application, and load each as a configuration resource.</li><li>Check for the existence of a context initialization parameter named <span
class="code">com.ocpsoft.pretty.CONFIG_FILES</span>. If it exists, treat it as a comma-delimited list of context relative resource paths (starting with a <span
class="code">/</span>), and load each of the specfied resources.</li><li>Check for the existence of a web application configuration resource named <span
class="code">/WEB-INF/pretty-config.xml</span>, and load it if the resource exists.</li></ol><h3 style="margin-bottom: 15px;"><a
name="application"></a><a
href="#configuration"><strong>3. Advanced Features</strong></a></h3><h4 style="margin-bottom: 15px;"><a
name="dynamicviewid"></a><a
href="#configuration"><strong>3.1 Using Dynamic View ID Capabilities</strong></a></h4><p>Dynamic view IDs allow a mapped URL to display content from any JSF view. This is prevents doing redirects which would otherwise destroy information stored in the URL, and also provides some extra functionality for application design.</p><p>This pretty-config mapping uses a dynamic view-id:</p><div
class="wp_syntax"><div
class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pretty-config</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://ocpsoft.com/prettyfaces-xsd&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://ocpsoft.com/prettyfaces-xsd </span>
<span style="color: #009900;">	http://ocpsoft.com/xml/ns/prettyfaces/pretty-1.0.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-mapping</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;home&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> /home <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;query-param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;displayWelcomeMessage&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>#{homeBean.displayWelcomeMessage}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/query-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> #{homeBean.getViewPath} <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pretty-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div><p>The corresponding backing-bean method must return a JSF ViewID, which will proceed with the faces lifecycle (leaving the URL /home), or a pretty:mappingId. In the case when a pretty:mappingId is returned, PrettyFaces will &#8220;switch mappings&#8221; and instead treat the request as if it had been sent to the new mappingId, without issuing a browser redirect.</p><div
class="wp_syntax"><div
class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ManagedBean
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getViewPath<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// This method returns the path of the JSF view to display</span>
        <span style="color: #666666; font-style: italic;">// when the URL /home is accessed.</span>
        <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>user.<span style="color: #006633;">isLoggedIn</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
        	<span style="color: #666666; font-style: italic;">// Note: the extension '.jsf' is the mapped faces extension</span>
        	<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;/faces/home.jsf&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// The home page can instead display a different view; return</span>
        <span style="color: #666666; font-style: italic;">// the pretty:mappingId of the view you wish to display.</span>
        <span style="color: #666666; font-style: italic;">// Note that this will not cause a redirect, and will not </span>
        <span style="color: #666666; font-style: italic;">// change the client browser URL.</span>
        <span style="color: #666666; font-style: italic;">// If you wish to issue a redirect, you should use a page</span>
        <span style="color: #666666; font-style: italic;">// load action instead of a dynamic view Id function.</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;pretty:login&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><h4 style="margin-bottom: 15px;"><a
name="queryparams"></a><a
href="#configuration"><strong>3.2 Using the Managed Query Parameter facility</strong></a></h4><p>Managed query parameters allow automatic assignment of values into JSF managed bean fields, instead of parsing and URL Decoding the value manually out of the request object. Examining this sample mapping, we can see that the developer has specified two managed query-parameters. The &#8216;sortBy&#8217; and &#8216;itemId&#8217; parameters.</p><div
class="wp_syntax"><div
class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pretty-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-mapping</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;itemList&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> /items/list <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;query-param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;sortBy&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>#{itemBean.sortByField}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/query-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;query-param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;itemId&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>#{itemBean.currentItemId}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/query-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> /faces/items/list.jsf <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>#{itemBean.loadItems}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/action<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pretty-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div><h5>The managed bean that accompanies this mapping:</h5><div
class="wp_syntax"><div
class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ItemBean
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> List<span style="color: #339933;">&lt;</span>Item<span style="color: #339933;">&gt;</span> items<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Integer</span> currentItemId<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> sortByField<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> deleteItem<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// currentItemId will be automatically populated by</span>
		<span style="color: #666666; font-style: italic;">// PrettyFaces if the parameter was passed in the request</span>
		<span style="color: #666666; font-style: italic;">// (see example JSF page below)</span>
		ItemManager.<span style="color: #006633;">deleteById</span><span style="color: #009900;">&#40;</span>currentItemId<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Redisplay the current page via redirect.</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;pretty:&quot;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> loadItems<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// The sortByField member will be null if the sortBy</span>
		<span style="color: #666666; font-style: italic;">// query-parameter is not found in the request</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">items</span> <span style="color: #339933;">=</span> ItemManager.<span style="color: #006633;">getSortedItems</span><span style="color: #009900;">&#40;</span>sortByField<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//... getters and setters...</span>
<span style="color: #009900;">&#125;</span></pre></div></div><h5>Example JSF page: <i>Notice the &lt;f:param&gt; tag.</i></h5><p>This will generate a link that provides the &#8216;itemId&#8217; parameter to the request for PrettyFaces to parse.</p><div
class="wp_syntax"><div
class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:forEach</span> <span style="color: #000066;">var</span>=<span style="color: #ff0000;">&quot;item&quot;</span> <span style="color: #000066;">items</span>=<span style="color: #ff0000;">&quot;${itemBean.items}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:commandLink<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		Delete this item.
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;f:param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;itemId&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${item.id}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:commandLink<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/c:forEach<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div><h4 style="margin-bottom: 15px;"><a
name="navigation"></a><a
href="#configuration"><strong>3.3 Wiring navigation into JSF action methods</strong></a></h4><div
class="wp_syntax"><div
class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PageBean
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> goHome<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// this will tell pretty to redirect the client to the home-page</span>
        <span style="color: #666666; font-style: italic;">// no parameters are mapped, so this is pretty simple</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;pretty:home&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> goHomeAndWelcome<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// this will tell pretty to redirect the client to the home-page</span>
        <span style="color: #666666; font-style: italic;">// since there is a managed query-parameter defined in the mapping,</span>
        <span style="color: #666666; font-style: italic;">// PrettyFaces will generate the URL, and append the mapped param</span>
        <span style="color: #666666; font-style: italic;">// eg: /home?displayWelcome=true </span>
        homeBean.<span style="color: #006633;">displayWelcomeMessage</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;pretty:home&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> goViewStory<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// this will tell pretty to redirect the client to the viewStory page</span>
        <span style="color: #666666; font-style: italic;">// PrettyFaces will generate the URL by extracting any values from</span>
        <span style="color: #666666; font-style: italic;">// the mapping beans and using them to inject back into the pattern</span>
        <span style="color: #666666; font-style: italic;">// therefore, navigation can be controlled by placing a value into</span>
        <span style="color: #666666; font-style: italic;">// the mapped field before PrettyFaces extracts it and generates the URL</span>
	<span style="color: #666666; font-style: italic;">// so... /story/#{myBean.currentStoryId}/ ...becomes... /story/12/ </span>
&nbsp;
        viewStoryBean.<span style="color: #006633;">setCurrentStoryId</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;pretty:viewStory&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> doRefreshByRedirect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// using the &quot;pretty:&quot; prefix without a mapping-id will cause a</span>
        <span style="color: #666666; font-style: italic;">// redirect to the current page</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;pretty:&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> doNormalJSFRender<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// returning an value without the &quot;pretty:&quot; prefix will fall back to</span>
        <span style="color: #666666; font-style: italic;">// the default JSF navigation handlers</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;someNavigationCase&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><h4 style="margin-bottom: 15px;"><a
name="customparsing"></a><a
href="#configuration"><strong>3.4 Parsing complex / dynamic-length URLs</strong></a></h4><p>Consider the following example configuration and bean: The URL contains many dynamic layers of mysite.com/value/value2/value3/&#8230;/valueN, which cannot be specified using a static URL pattern.</p><p> Since patterns are regexes, we can use a catch-all pattern, and process the values ourselves.</p><div
class="wp_syntax"><div
class="code"><pre class="xml" style="font-family:monospace;">	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-mapping</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;dynamicUrl&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> /blog/categories/.* <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> #{urlParsingBean.parseComplexUrl} <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/view-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div><p> Example of a complex URL parser. Remember to URLDecode before using any values from the URL:</p><div
class="wp_syntax"><div
class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> UrlParsingBean
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> parseComplexUrl<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">UnsupportedEncodingException</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">String</span> uri <span style="color: #339933;">=</span> PrettyContext.<span style="color: #006633;">getCurrentInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getOriginalUri</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> categoryChain <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span>uri.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">int</span> index <span style="color: #339933;">=</span> uri.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003399;">String</span> value <span style="color: #339933;">=</span> uri.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, index<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            categoryChain.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">URLDecoder</span>.<span style="color: #006633;">decode</span><span style="color: #009900;">&#40;</span>value, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            uri <span style="color: #339933;">=</span> uri.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span>index<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//now load the data...</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;/blag/viewArticle.jsf&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><h4 style="margin-bottom: 15px;"><a
name="elaccess"></a><a
href="#configuration"><strong>3.5 Accessing PrettyContext through EL</strong></a></h4><p>Since a new PrettyContext is generated on each request, and stored into the requestMap, it is possible to access the context object through EL in a JSP, or Facelet.</p><p><div
class="wp_syntax"><div
class="code"><pre class="xml" style="font-family:monospace;">&nbsp;
#{prettyContext.currentInstance} <span style="color: #808080; font-style: italic;">&lt;!-- returns the current PrettyContext --&gt;</span>
#{prettyContext.currentInstance.currentMapping.id} <span style="color: #808080; font-style: italic;">&lt;!-- returns the current UrlMapping Id --&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- And so on... --&gt;</span></pre></div></div><h3 style="margin-bottom: 15px;"><a
name="links"></a><a
href="#configuration"><strong>4. Rendering HTML Links and URLs</strong></a></h3><h4><a
name="prettylink"></a>4.1 The pretty:link component</h4><p>PrettyFaces provides a JSF component to output an HTML link to the page. The link tag requires a mapping-id (specified in the pretty-config.xml,) identifying which link to render.</p><p>If the provided mappingId requires any url-pattern-parameters or managed-query-parameters, they can be passed in via the &lt;f:param&gt; tag.</p><p>Url pattern parameters can be passed individually, as a java.util.List or as an Array. In the latter two cases, toString() will be called on each of the objects in the list/array. If an empty or null list/array is passed, it will be ignored.</p><p>Url pattern parameters do NOT have a name attribute, and are parsed in the order they are passed into the tag. Managed-query-parameters DO have a name attribute, and order is irrelevant.</p><p><strong>For Example:</strong> The viewComment pattern requires:</p><div
class="wp_syntax"><div
class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- From pretty-config.xml, viewComment mapping-id, above:</span>
<span style="color: #808080; font-style: italic;"> /story/#{myBean.currentStoryId}/#{myBean.commentId}--&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;%@ taglib <span style="color: #000066;">prefix</span>=<span style="color: #ff0000;">&quot;pretty&quot;</span> <span style="color: #000066;">uri</span>=<span style="color: #ff0000;">&quot;http://ocpsoft.com/prettyfaces&quot;</span> %<span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pretty:link</span> <span style="color: #000066;">mappingId</span>=<span style="color: #ff0000;">&quot;comment&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;f:param</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#{myBean.currentStoryId}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;f:param</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#{myBean.commentId}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	Go to Comment. (This is Link Text)
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pretty:link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div><h4><a
name="urlbuffer"></a>4.2 The pretty:urlbuffer component</h4><p>PrettyFaces provides a JSF component to generate a URL for use as a page scoped variable through El. This tag requires a mapping-id (specified in the pretty-config.xml)</p><p>If the provided mappingId requires any url-pattern-parameters or managed-query-parameters, they can be passed in via the &lt;f:param&gt; tag.</p><p>Url pattern parameters can be passed individually, as a java.util.List or as an Array. In the latter two cases, toString() will be called on each of the objects in the list/array. If an empty or null list/array is passed, it will be ignored.</p><p>Url pattern parameters do NOT have a name attribute, and are parsed in the order they are passed into the tag. Managed-query-parameters DO have a name attribute, and order is irrelevant.</p><p><strong>For Example:</strong> The viewItem pattern requires:</p><div
class="wp_syntax"><div
class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- From the managed-query-parameter section above, itemList mapping-id.--&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pretty:urlbuffer</span> <span style="color: #000066;">var</span>=<span style="color: #ff0000;">&quot;itemListUrl&quot;</span> <span style="color: #000066;">mappingId</span>=<span style="color: #ff0000;">&quot;itemList&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;f:param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;itemId&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;22&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;f:param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;sortBy&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;price&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pretty:urlbuffer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:outputText</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Generated Url Is: #{requestScope.itemListUrl}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #808080; font-style: italic;">&lt;!-- /items/list?itemId=22&amp;sortBy=price --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;br</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div><p>This design is intended to reduce complexity and prevent manual manipulation of URLs.</p><h3 style="margin-bottom: 15px;"><a
name="logging"></a><a
href="#configuration"><strong>5. Configuring Logging (log4j)</strong></a></h3><h4>example log4j.properties</h4><div
class="wp_syntax"><div
class="code"><pre class="config" style="font-family:monospace;">### 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
&nbsp;
### set log levels - for more verbose logging change 'info' to 'debug' ###
&nbsp;
log4j.rootLogger=warn, stdout
&nbsp;
#this will set PrettyFaces logging level to 'info'
log4j.logger.com.ocpsoft.pretty=info</pre></div></div><h3 style="margin-bottom: 15px;"><strong>Finished. Run your application!</strong></h3><p>You should now have a fully functional PrettyFaces configuration.</p><div
style="align: center; background: #555; padding: 10px"><form
action="http://groups.google.com/group/prettyfaces-users/boxsubscribe"><table
border="0" cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td
colspan='2' align="center"><strong>Subscribe to <a
href="http://groups.google.com/group/prettyfaces-users">prettyfaces-users</a></strong></td></tr><tr><td
align="right" width="45%"><label
for="subeml2" style="color: #eee">Email:&nbsp;</label></td><td
align="left"> <input
id="subeml2" name="email" size="18" type="text" /> <input
name="sub" type="submit" value="Subscribe" /></td></tr></tbody></table></form></div><p><br/><br/></p> ]]></content:encoded> <wfw:commentRss>http://ocpsoft.com/prettyfaces/v123/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> <item><title>Java Server Faces 2.0 is in Good Hands</title><link>http://ocpsoft.com/java/jsf2-in-good-hands/</link> <comments>http://ocpsoft.com/java/jsf2-in-good-hands/#comments</comments> <pubDate>Tue, 10 Feb 2009 23:44:39 +0000</pubDate> <dc:creator>Lincoln</dc:creator> <category><![CDATA[JSF]]></category> <category><![CDATA[Java]]></category> <category><![CDATA[JSF 2.0]]></category> <category><![CDATA[OpenSource]]></category> <category><![CDATA[PrettyFaces]]></category><guid
isPermaLink="false">http://ocpsoft.com/?p=41</guid> <description><![CDATA[&#8220;The community was speaking, but until recently, nobody was listening.&#8221; A lot has changed since May 15, 2001, when the first ballot review of the JSF 1.0 framework was just beginning. To this day, Sun&#8217;s flagship web-application framwork has been an uncompromising box of tricks and gotchas, with little community adoption. This has been mostly [...]]]></description> <content:encoded><![CDATA[<blockquote><h2 style="text-align: center;">&#8220;The community was speaking, but until recently, nobody was listening.&#8221;</h2></blockquote><p>A lot has changed since May 15, 2001, when the first ballot review of the JSF 1.0 framework was just beginning. To this day, Sun&#8217;s flagship web-application framwork has been an uncompromising box of tricks and gotchas, with little community adoption. This has been mostly due to its relatively developer-unfriendly nature; however, the second phase is coming, and with JSF2.0 peeking out from the edge of its nest, a new life is beginning to show.</p><p><span
id="more-41"></span></p><p>From the start, JSF had mixed support from the community, with opposition from major players like IBM, HP, and the Apache Foundation. Apache voiced strong concerns because of &#8220;Sun&#8217;s current position that JSRs may not be independently implemented under an open source license.&#8221; In addition, they saw, &#8220;little value in recreating a technology [Struts] in a closed environment that is already available in an open environment.&#8221;<a
name="sdfootnote1anc" href="#sdfootnote1sym"><sup>1</sup></a></p><p>Apache&#8217;s concerns drew several other players to vote against JSF, but the final vote still passed with a 10-5 margin (Accenture abstained from voting.) With the voting complete a short two weeks later, the first JSF expert group was formed.</p><p>Three months after the formation of the expert group, the first JCP community review was complete, and Sun&#8217;s new star web-framework was on its way to reality. On the side of the box was a label, which read, &#8220;Final release, May 2004: Warranty Void if Removed&#8221; It was done, and their hands were off.</p><blockquote><h2 style="text-align: center;">But <em>some things that should not have been forgotten, were lost.</em></h2></blockquote><p>Since JSF was engineered by companies like IBM and Oracle, major contractors in the industry, most of the emphasis was placed on creating a modular architecture that could be &#8216;easily extended&#8217; and broken down into components. While technically sound, and well designed for large companies where developers are part of an assembly line, the community at large found JSF hard to use.</p><p>JSF lacked life-cycle extension; there are six defined phases, and if you need to add another one, you&#8217;re out of luck. Also lacking was easy component creation &#8212; Creating a component in JSF today requires modification of no fewer than four separate files, even more if you use a separate renderer class. You were on your own if you wanted to validate multiple form fields against each other.</p><p>Navigation rules were ungainly, and difficult to follow logically without a visual editor. Community documentation was almost a joke. Sun&#8217;s mailing list and <a
href="http://forums.sun.com/forum.jspa?forumID=427&amp;start=0">forum</a> are still the best places to find help. There are some very knowledgeable people, but nowhere to be found is what most developers find most useful: a central, persistent resource for documentation. I like <a
href="http://www.php.net/manual/en/control-structures.foreach.php">PHP&#8217;s model</a> &#8211; official documentation with community feedback in comments below.</p><p>The lack of bookmarking support is one of the most highly-criticised facets of JSF, which is where I got involved, leading me to create the <a
href="../../../../../prettyfaces">PrettyFaces</a> URL rewriting extension. If you need to be convinced of the collective dysfunction on this topic, look at the results of a google search for &#8220;jsf bookmark&#8221;. Yet, at the root of all this was something JSF lacked until very recently &#8211; something very important.</p><blockquote><h2 style="text-align: center;"><em>A set of ears.</em></h2></blockquote><p
align="left">The community was speaking, but until recently, nobody was listening. Blame JCP? Cay Horstmann thinks that <a
href="http://weblogs.java.net/blog/cayhorstmann/archive/2009/01/a_call_to_fix_t.html">the JCP needs to be more open</a> to the community.<a
name="sdfootnote2anc" href="#sdfootnote2sym"><sup>2</sup></a></p><p
align="left">Personally, I&#8217;m surprised that JSF wasn&#8217;t abandoned completely, which says in my mind, &#8220;they got something right.&#8221; The framework does a lot for you, but &#8220;I can&#8217;t figure out how to use it&#8221;, &#8220;it doesn&#8217;t do what I need,&#8221; and &#8220;everything takes forever.&#8221;. This is where we see the light, and JSF2 enters from stage left; a new star performer?</p><p
align="left">From the very start, JSF2 is different, more open. Ed Burns, Ryan Lubke, Jim Driskoll and other <a
href="http://weblogs.java.net/">blogging developers</a> can be thanked for engaging the community in a way that Sun has not done before.</p><p
align="left">Convention over configuration has taught us a lot. We might thank Ruby on Rails, or possibly a collective laziness, but the <a
href="http://jcp.org/en/jsr/detail?id=314">JSR314</a> Expert Group has taken it to heart. &#8220;EzComp&#8221; is JSF&#8217;s new component writing system, and yes, it&#8217;s &#8220;Ez&#8221;.</p><p
align="left">Jim Driscoll <a
href="http://weblogs.java.net/blog/driscoll/archive/2008/11/another_jsf_20_1.html">explains</a> how to create a &#8220;click to edit&#8221; AJAX input field, like those so popularly seen on Flickr, or Facebook. (About 30 lines of XHTML, plus JavaScript.) Tag libraries no longer need to be defined manually; they will <a
href="http://weblogs.java.net/blog/driscoll/archive/2008/11/writing_a_simpl_1.html">spring to life</a> as needed, based on the names and interfaces of your components.</p><p
align="left">JSF2 is showing stunning promise and vision. This is just a small set of changes that will drastically improve the usefulness and adoption of JSF. When a rookie Java web-developer can pick up JSF2.0, in their IDE of choice, and write a small, useful application in a day, that&#8217;s when we&#8217;ll know they&#8217;ve gotten it right. Man, life is good&#8230; but.</p><blockquote><h2 style="text-align: center;"><em>Where are my bookmarks?</em></h2></blockquote><p
align="left">Ahh yes.</p><p
align="left">After learning about JSF2 in mid-October, I&#8217;ve been following very closely the changes and discussions around its new architecture, and how it can be &#8216;fixed.&#8217; At the top of <a
href="http://www.jsfcentral.com/editorial/jsf2_wishlist_1.html">the wish list</a>, among other contenders like &#8220;Fixing Navigation Rules,&#8221; and even above &#8220;Simplified component development,&#8221; is one very near to my heart: &#8220;Enhanced support for GET requests.&#8221;</p><p
align="left">I began work on <a
href="../../../../../prettyfaces">PrettyFaces</a> before learning that JSF2 was in progress, but not before I had evaluated the other options available from the community. Jboss Seam had a UrlRewriting feature, but I found it cumbersome, requiring too much configuration, and the added burden of learning the entire Seam framework was too much for me. RestFaces was an alternative that I tried for a while, but several design choices made it difficult to incorporate in a non-invasive way, and I was left writing lines and lines of code in order to compensate for its (albeit few) shortcomings.</p><p
align="left">Shocked, disappointment struck when I was contacted by a PrettyFaces user, disheartened, who urged me to contact the JSF2 expert group because they were <a
href="http://forums.sun.com/thread.jspa?messageID=10541909#10541909">close to abandoning</a> bookmarking support for the next release, a full five years after the last specification update. How could they be considering omitting such a critical feature? It would surely finish off whatever damage had been done by the first 8 years of JSF&#8217;s mis-managed life, and it would be dead forever. &#8220;Long live Struts,&#8221; Apache would tout.</p><blockquote><h2 style="text-align: center;"><em>New life.</em></h2></blockquote><p
align="left">But fate struck, and before I could even begin to write emails, begging for reconsideration, I got another pop-up from my inbox.</p><p
align="left">From: Dan J. Allen &#8211; Jan 10, 2:50pm</p><p
style="padding-left: 30px; text-align: justify;"><tt>Lincoln,</tt></p><p
style="padding-left: 30px; text-align: justify;"><tt>Hey there. I have recently joined the JSF EG by way of my employment with Red Hat. My first action was to submit a couple of proposals to make JSF more "website friendly". After all, that is what got me interested in Seam in the first place.</tt></p><p
style="padding-left: 30px; text-align: justify;"><tt>In the most recent proposal, I cited the statements you made in a recent blog post. I have attached that proposal to this e-mail as well as a related proposal. We are listening (at least those of us at Red Hat) and we are trying our best to improve JSF within the boundaries that we have to work (i.e., the JCP). The JSF EG was definitely dysfunctional in the past, but Ed Burns, Red Hat, and a handful of other members have really started to turn things around. Adding pretty URLs is definitely too big of a change at this point given the time constraints, but you may find these two proposals to satisfy many of your other concerns. Feel free to provide feedback to the JSF EG regarding the design changes.</tt></p><p
style="padding-left: 30px; text-align: justify;"><tt>-Dan</tt></p><p
align="left">Dan is the author of <a
href="http://www.manning.com/dallen/">Seam in Action</a>, and from my interactions with him, a brilliant individual. If he isn&#8217;t rich already, in heart or on paper, he will be someday.</p><p
align="left">Struck by two emails on this subject in the same day, I &#8220;hurriedly&#8221; (from 11pm-2am) typed a response. Someone at RedHat was asking <em>me</em> for <em>my feedback?</em> Talk about an ego trip. My friends at work won&#8217;t let me hear the end of it.</p><p
align="left">The proposal was stunning. While still omitting Pretty URL rewriting, it contained in depth solutions for using query-string parameters (http://url?key=value) to bookmark pages within JSF. It lacked page-load actions, but that would follow, as we talked through the issues, in the next few days.</p><p
align="left">During the process of reviewing Dan&#8217;s proposals, providing feedback where I could, and wishing I weren&#8217;t just a part-time contributor, we worked through issues regarding usability, convention over configuration, and strategies for implementing the new functionality that would be required. Two weeks and 91 emails later, we had a draft of the spec, and off it went (via Pete Muir at RedHat) to the Expert Group for review.</p><p
align="left">The proposal was accepted; Dan&#8217;s job got even better. Within a week, he would have to implement his proposed specification, create a sample application, make any necessary changes to the spec, submit it back to the EG, and believe me, it was good.</p><blockquote><h2 style="text-align: center;"><em>Things yet to come.</em></h2></blockquote><p
align="left">JSF2 is still under review, and all of these changes may yet be changed, but I&#8217;m confident that the people in charge have heads on their shoulders, and that they are pointing in the right direction.</p><p
align="left">I&#8217;m impressed. Impressed by Dan Allen, Jim Driscoll, Ryan Lubke, and by Sun for starting to recognize that its developer community is its best chance at survival. JSF2 won&#8217;t have everything that we&#8217;ve asked for, but it will have the most critical features that the community has asked for. I&#8217;m impressed that it&#8217;s turning out so well: Component writing is truly easy; pages will be bookmark-able; templating is built in; and annotations are on the way to deprecating faces-config.xml for trivial tasks.</p><p
align="left">So what can Sun do next? Well. For starters, keep listening. Don&#8217;t limit ideas to people on its payroll. JSF2 will be a success if Sun gives users a voice.</p><p
align="left">The developer blogs are great, but we need a centralized place for core documentation. The site needs to be fast, and you should be able to easily register and contribute. Yes, it will take management and oversight, but we aren&#8217;t out to hurt anyone. Dear sun: &#8220;We like what you&#8217;re doing, and the direction in which we think you might be turning. We&#8217;re here to further the cause of software development, and guess what&#8230; If you listen to us&#8230; we&#8217;ll do it for free.&#8221;</p><p
align="left">Whether or not this happens, the future of JSF is in our hands.</p><p
style="text-align: center;">&#8211;</p><p><a
name="sdfootnote1sym" href="#sdfootnote1anc">1</a><a
href="http://www.jcp.org/en/jsr/results?id=614" target="_blank">http://www.jcp.org/en/jsr/results?id=614</a></p><p><a
name="sdfootnote2sym" href="#sdfootnote2anc">2</a><a
href="http://weblogs.java.net/blog/cayhorstmann/archive/2009/01/a_call_to_fix_t.html" target="_blank">http://weblogs.java.net/blog/cayhorstmann/archive/2009/01/a_call_to_fix_t.html</a></p> ]]></content:encoded> <wfw:commentRss>http://ocpsoft.com/java/jsf2-in-good-hands/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>JSF 2.0 &#8211; Bookmark Extension for Pretty URL Mapping</title><link>http://ocpsoft.com/java/jsf-java/jsf-20-bookmark-extension-for-pretty-url-mapping/</link> <comments>http://ocpsoft.com/java/jsf-java/jsf-20-bookmark-extension-for-pretty-url-mapping/#comments</comments> <pubDate>Sun, 04 Jan 2009 06:00:54 +0000</pubDate> <dc:creator>Lincoln</dc:creator> <category><![CDATA[JSF]]></category> <category><![CDATA[PrettyFaces]]></category> <category><![CDATA[Releases]]></category> <category><![CDATA[JSF 2.0]]></category><guid
isPermaLink="false">http://ocpsoft.com/?p=38</guid> <description><![CDATA[It didn&#8217;t make it&#8230; Well folks, for those of you who were hoping JSF 2.0 would contain the URL rewriting tools that many had asked for, unfortunately it looks like it&#8217;s not going to make it into the official spec. Bookmarking a page, or pages in JSF has been a heavily requested feature, but according [...]]]></description> <content:encoded><![CDATA[<h3>It didn&#8217;t make it&#8230;</h3><p>Well folks, for those of you who were hoping JSF 2.0 would contain the URL rewriting tools that many had asked for, unfortunately it looks like it&#8217;s not going to make it into the official spec. Bookmarking a page, or pages in JSF has been a heavily requested feature, but according to <a
href="http://forums.sun.com/thread.jspa?messageID=10541909#10541909" target="_blank">this discussion</a>, is currently out of scope.</p><h3>But that&#8217;s ok&#8230;</h3><p>The <a
href="http://ocpsoft.com/prettyfaces" title="SEO, Dynamic Parameters, Bookmarks, and Navigation for JSF / JSF2">PrettyFaces</a> JSF Bookmark extension has been updated for JSF 2.0, and is ready for public preview (download below).</p><p><span
id="more-38"></span></p><p>Only minor updates were required, and should be stable, but due to the un-finalized nature of JSF 2.0 itself, the extension may change as well.</p><div
class="featured"><div
class="inside"><p>Download <a
href="http://ocpsoft.com/prettyfaces" title=" SEO, Dynamic Parameters, Bookmarks, and Navigation for JSF / JSF2">PrettyFaces</a> now!</p></div></div><h3>Please note:</h3><p> Parsed parameters are now assigned to Managed Beans <em>after</em> the RESTORE_VIEW phase. Previously this had taken place before the RESTORE_VIEW phase.</p> ]]></content:encoded> <wfw:commentRss>http://ocpsoft.com/java/jsf-java/jsf-20-bookmark-extension-for-pretty-url-mapping/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>PrettyFaces 1.2.0 Released</title><link>http://ocpsoft.com/java/jsf-java/prettyfaces-120-released/</link> <comments>http://ocpsoft.com/java/jsf-java/prettyfaces-120-released/#comments</comments> <pubDate>Wed, 31 Dec 2008 22:16:11 +0000</pubDate> <dc:creator>Lincoln</dc:creator> <category><![CDATA[JSF]]></category> <category><![CDATA[PrettyFaces]]></category> <category><![CDATA[Releases]]></category><guid
isPermaLink="false">http://ocpsoft.com/?p=36</guid> <description><![CDATA[A new major release of the PrettyFaces JSF extension for Bookmarkable/Pretty URLs is now available for download. Version 1.2.0: binary, source Major Release: 20081231 Added managed query-parameter support for URLs and JSF forms New URL Buffer component makes using dynamic URLs easy URL encoding/decoding now complies with W3C standards Dynamic View Ids now allow returning [...]]]></description> <content:encoded><![CDATA[<p>A new major release of the <a
href="http://ocpsoft.com/prettyfaces">PrettyFaces</a> JSF extension for Bookmarkable/Pretty URLs is now available for download.</p><p><span
id="more-36"></span></p><p><strong>Version 1.2.0</strong>: <a
href="http://prettyfaces.googlecode.com/files/ocpsoft-pretty-faces-1.2.0.jar">binary</a>, <a
href="http://prettyfaces.googlecode.com/files/ocpsoft-pretty-faces-1.2.0-src.jar">source</a></p><p>Major Release: 20081231</p><ol><li>Added managed query-parameter support for URLs and JSF forms</li><li>New URL Buffer component makes using dynamic URLs easy</li><li>URL encoding/decoding now complies with W3C standards</li><li>Dynamic View Ids now allow returning pretty:navigation strings to display another view without issuing redirect or changing the client browser URL</li><li>Enhanced exception messages for much of the URL Parsing and Building</li></ol> ]]></content:encoded> <wfw:commentRss>http://ocpsoft.com/java/jsf-java/prettyfaces-120-released/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Served from: ocpsoft.com @ 2010-07-29 17:12:01 by W3 Total Cache -->