V
V
Vetal Matitskiy2015-04-20 08:37:56
Java
Vetal Matitskiy, 2015-04-20 08:37:56

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

3 answer(s)
B
bromzh, 2015-04-21
@bromzh

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

Add this to web.xml

T
Timur, 2015-04-20
@timych

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

I
idyoshin, 2015-04-20
@idyoshin

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 question

Ask a Question

731 491 924 answers to any question