File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes JSF Url Mapping (Newbie) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF Url Mapping (Newbie)" Watch "JSF Url Mapping (Newbie)" New topic

JSF Url Mapping (Newbie)

Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
Hi all,

I am still a newbie to JSF. I used IBM RAD to create a sample JSF application for me. It is basically a page that fetches some data from the db and displays it. What RAD generated for me was a .xhtml file with a datatable to show the contents of the data, a faces.config xml file and web.xml. The web.xml of course had the following...

And faces.config.xml had following...

AdviceDetailManager is like a JPA DAO which has the JPA code to fetch the data. And my xhtml page is "advice_inquiry.xhtml". My question is when I call the URL "http://localhost:9080/AdvisingWeb/advice_inquiry.faces", how does Faces Servlet know to find AdviceDetailManager to get it the data it needs. The URL mapping in JSF does not seem so straighforward as Struts.

Thanks for any help.

Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

When in you page you call a method like: adviceDetailManager.yourMethod the JSF will know which class to find this method.

I believe it is easier than Struts.

You just need to map the class. [=

[] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

This is why we are so anti-IDE on forums like these. You've got extremely powerful tools generating complex things, but you don't actually know how the things work.

When people do that to build real-world professional applications, the results are usually pretty horrible. Doubly-so when some "expert" is in charge of the staff, dictating silly standards based on imperfect knowledge that is often outdated.

I strongly recommend getting a good book on JSF and reading it to get familiar with the basic concepts. Once you've done that, the actions of the IDE will make more sense and you'll know how and why things are the way they are (even without the IDE).

This is standard advice we give everyone for everything, but especially meaningful for your question, since the URL mapping and dispatching in JSF is rather different than it is for most webapp frameworks.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: JSF Url Mapping (Newbie)
It's not a secret anymore!