• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF Url Mapping (Newbie)

 
Jehan Jaleel
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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. [=
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic