Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to mapping request /faces/*?

 
Ismael Rodriguez
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've problem mapping request with /faces/*

My web.xml





Hello.xhtml



welcome.xhtml



The project



when I start the project, it works fine, but when I push the link, the request is not found, why?. If welcome.xhtml file is in the same directory as hello.xhtml, also works correctly if the address change to "welcome"



 
Volodymyr Lysenko
Ranch Hand
Posts: 511
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

1. Two mappings for one FacesServlet is not good I have read.
2. You don't need folder faces to map FacesServlet to /faces/*. You only need to add this /faces/* in url and FacesServlet will process such urls and directs you to
path which is defined by removing word /faces/*.
3. You can't access page put into WEB-INF folder from browser. There you can put templates, composite components, configuration files.

I would recommend to pass at first good tutorial on jsf like this http://www.coreservlets.com/JSF-Tutorial/jsf2/ !!!
 
Ismael Rodriguez
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Volodymyr Levytskyi wrote:Hello!
2. You don't need folder faces to map FacesServlet to /faces/*. You only need to add this /faces/* in url and FacesServlet will process such urls and directs you to
path which is defined by removing word /faces/*.


OK, Thank.

If i want to have a directory structure with several directories with xhtml file, how i do reference them in index.xhtml ?
For examlple

Webcontent
|---login
|--login.xhtml
|---|ex
|--ex.xhtml
|--index.xhtml

and the mapping in servlet is /faces/*?
 
Volodymyr Lysenko
Ranch Hand
Posts: 511
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

http://localhost:8080/projectName/faces/folder1/folder2/folder3/mypage.xhtml

Wherever in your webcontent you have some page you can reference mypage.xhtml by /folder1/folder2/folder3/mypage3.xhtml.
You simply take path to page in webcontent
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic