Answer the question
In order to leave comments, you need to log in
How to fix the situation when GlassFish does not process JSF pages?
Good afternoon, dear Java gurus,
I'm making a simple Java web application in NetBeans, I added support for JavaServer Faces to the project. The project compiles and runs, but when jsf pages are requested, a blank screen is displayed in the browser. Going into the source code of the page, I saw that all the JavaServer Faces markup remained unprocessed there. Tell me, please, what can be written so that the server still processes JSF pages?
Answer the question
In order to leave comments, you need to log in
<!-- JSF mapping -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map these files with JSF -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
I have been tinkering with .jsf for a long time, but as far as I remember, if you do not configure the mapping to the Faces Servlet in web.xml, then by default, in order for faces to work, you need to insert "faces" in the path to the jsp/xtml file. For example, localhost:8080/faces/mypage.jsp
Otherwise, faces does not work, although there will be access to the file.
Try it.
Better yet, throw off web.xml
what version of glassfish?
If it's quite old (with JEE5), it's enough just to throw an empty faces-config.xml into WEB-INF.
If it's fresh: by default, all jsf views are now facelets. - you see most likely pure xhtml - instead of xhtml suffix it is enough to add jsf (by default in JEE7
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question