This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF navigation with PrettyFaces

 
Andrew Dambrosio
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSF 2.0 web app that stores every page in a database table. The table includes the "pretty" URL for the page.
What I would like to do is, if you enter the URL "www.test.com/com/aboutus.html" This should access the actual page of "www.test.com/faces/pages.xhtml?url=%2Fcom%2Faboutus.html"

Basically, any of my pages need to access the pages.xhtml file, passing in the pretty URL and displaying the pretty URL in the browser navigation bar.
I think I should use Pretty Faces to do this, but I'm not sure how to set it up.
Does anyone know?
 
Tim Holloway
Bartender
Posts: 18423
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a little confused about what you are asking.

You are using a sample URL with "html" in it, and that ordinarily isn't going to be a JSF target. Incidentally, JSF navigation can ONLY go to JSF targets, not to general (non-JSF) URLs such as vanilla HTML pages.

A URL would also not normally have ".xthml" in it, because xhtml's are resources and the JSF/Facelets resource resolution mechanism doesn't accept direct resource references, it accepts JSF-mapped URLs, which are then used as the basis for locating resources based on the rules defined in web.xml. So, in other words, "/dir1/page2.jsf" -> "/dir1/page2.xhtml".
 
Andrew Dambrosio
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My JSF pages need to appear as HTML pages. I've figured out that using PrettyFaces is my best option.
 
Tim Holloway
Bartender
Posts: 18423
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSF pages almost always appear as HTML pages. JSF contains an abstract View rendering system that that takes View Templates (xhtml), binds JSF Model objects (backing beans) to them, then applies a plugin-in rendering engine to the resulting sets to produce output. By default a built-in engine that generates HTML is used.

This is not the same thing as brute-force raw HTML. JSF does not support HTML for navigation purposes, only JSF Views. Any moving to or from raw HTML web pages has to be done manually.
 
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!