Re: New in Rewrite

Splash Forums PrettyFaces Users New in Rewrite Re: New in Rewrite

#23388

“Rewrite” is both. A configuration element in PrettyFaces and a separate project. :)

Let me explain:

There is PrettyFaces, which is a URL rewriting framework for JSF. PrettyFaces is very stable and I use it in many projects. In PrettyFaces you can use pretty-config.xml to define either URL-mappings or simple rewrite rules. These rewrite rule are built using the XML element <rewrite>. It allows to define simple rewriting rules similar to mod_rewrite.

To get PrettyFaces up and running, have a look at:

http://ocpsoft.org/docs/prettyfaces/3.3.3/en-US/html/GettingStarted.html

For your usecase you should also have a look at:

http://ocpsoft.org/docs/prettyfaces/3.3.3/en-US/html/Configuration.html#config.mapping

In your case you should use a configuration like this:

<url-mapping id="home">
<pattern value="/home" />
<view-id value="/index.xhml" />
</url-mapping>

Or if you want to use annotations:

@URLMapping(id = "home", pattern = "/home", viewId = "/index.xhtml")
public class HomeBean {
/* your code */
}

There is also a separate project called “Rewrite”. This project is the successor of PrettyFaces. It’s a complete new project and fixes many of the weaknesses of PrettyFaces. If you want to learn more about Rewrite have a look at the Rewrite site:

Rewrite

I hope this clears up the situation a bit. :)