2

I have a blank page when i try to open my page http://localhost:8084/Gpsi-worked/admin.xhtml but when i try this http://localhost:8084/Gpsi-worked/faces/admin.xhtml that work where is the problem, im using template in my project.

Optimmus
  • 55
  • 2
  • 3
  • 12

3 Answers3

9

That's because the FacesServlet is mapped on an URL pattern of /faces/* instead of *.xhtml. The FacesServlet is the one responsible for doing all the JSF works. All requests to JSF pages have to invoke the FacesServlet. It will then parse the Facelets and JSF tags in the XML template and generate HTML code. Rightclick the blank page in your webbrowser and choose View Source. You'll see that all JSF tags are left unparsed. The webbrowser doesn't understand JSF tags, it only understands HTML.

In order to get rid of the /faces/* path, you need to change the URL pattern of the FacesServlet in web.xml from

<url-pattern>/faces/*</url-pattern>

to

<url-pattern>*.xhtml</url-pattern>

This has the only (minor) caveat that you cannot serve plain .xhtml files anymore without invoking the FacesServlet, but those files should actually be served as .html anyway ;)

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
0

In web.xml you will specify a servlet mapping and it will be looking for a URL path with /faces/* (or perhaps .faces too) in order to send requests to the FacesServlet. Change the mapping to something more suitable, if you don't want the /faces prefix.

planetjones
  • 12,469
  • 5
  • 50
  • 51
0

Are you sure it's a blank page? Because you should have got an error, maybe if you look at the source of the blank page you might see your JSF page unprocessed ?

Cosmin Cosmin
  • 1,526
  • 1
  • 16
  • 34