Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Rewriting URLs in JSF  RSS feed

 
Andris Sigs
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

I try to use ‘rewrite’ (http://ocpsoft.org/rewrite/ )in my JSF application. So, I want to show user friendly links. For example, I have /viewpage.xhtml?id=5 page, but I want to show /page/5 or, more better /page/{page-title} . How can I reach this functionality?

Thanks!
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you want to use PrettyFaces. PrettyFaces isn't so much a "URL Rewrite" facility as is is a way to support bookmarkable URLs such as the examples you gave.

PrettyFaces is one of my favorite JSF enhancements and I've been using it for a long time. It's really quite easy to incorporate. Just a library and a small mod to the web.xml to activate the PrettyFaces filter. Then you define your actual URL patterns either in a pretty-config file or (in the latest version) via annotations on the backing bean that will be handling the request.

The instructions on installing and basic use for PrettyFaces are fairly good. If you run into trouble, we're here!

Incidentally, while I have a great fondness for PrettyFaces, JSF2 did add some support for bookmarkable URLs itself, if your needs are simple enough.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!