This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSF and the fly likes How to mapping request /faces/*? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to mapping request /faces/*?" Watch "How to mapping request /faces/*?" New topic
Author

How to mapping request /faces/*?

Ismael Rodriguez
Greenhorn

Joined: Dec 26, 2012
Posts: 6
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 Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

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/ !!!


True person is moral, false is right!
Ismael Rodriguez
Greenhorn

Joined: Dec 26, 2012
Posts: 6
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 Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to mapping request /faces/*?