G
garhone
Hi,
First, I have searched high and low for the solution to this problem
.... but have found nothing.
All I'm trying to do is to be able to see a simple JSP page:
web.xml:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>false</param-value>
<description>
Set this flag to true if you want the JavaServer Faces
Reference Implementation to validate the XML in your
faces-config.xml resources against the DTD. Default
value is false.
</description>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
<description>
Comma separated list of URIs of (additional) faces config files.
</description>
</context-param>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>
<!-- Faces Servlet Mapping.
This mapping identifies a jsp page as having JSF content. If a
request comes to the server for foo.faces, the container will
send the request to the FacesServlet, which will expect a
corresponding foo.jsp page to exist containing the content.
-->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<!--
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
-->
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!--
Disallow direct access to the JSP pages that are
used for JSF. You must add a <url-pattern> entry
for each JSP page that corresponds to a faces page.
-->
<security-constraint>
<display-name>
Prevent access to raw JSP pages that are for JSF pages.
</display-name>
<web-resource-collection>
<web-resource-name>Raw-JSF-JSP-Pages</web-resource-name>
<!-- Add url-pattern for EACH raw JSP page -->
<url-pattern>/index.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<description>No roles, so no direct access</description>
</auth-constraint>
</security-constraint>
</web-app>
-----------------------------------------------------
index.jsp:
<!-- index.jsp -->
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Index</title></head>
<body>
<f:view>
<h2>This is a test</h2>
<p>
<h
utputText value="Hello World" />
</p>
</f:view>
</body>
</html>
----------------------------------------------------------
faces-config.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<!-- nothing relevant -->
</faces-config>
--------------------------------------------------------------
directory structure:
jsp/
index.jsp
WEB-INF/
classes/
faces-config.xml
lib/
web.xml
-----------------------------------------------------------
when I try to open http://hostname:port/app/faces/jsp/index.jsp
I get the 404 error: Requested resource is not available
Any help is appreciated, as I am going out of my mind!
Thanks,
C
First, I have searched high and low for the solution to this problem
.... but have found nothing.
All I'm trying to do is to be able to see a simple JSP page:
web.xml:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>false</param-value>
<description>
Set this flag to true if you want the JavaServer Faces
Reference Implementation to validate the XML in your
faces-config.xml resources against the DTD. Default
value is false.
</description>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
<description>
Comma separated list of URIs of (additional) faces config files.
</description>
</context-param>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>
<!-- Faces Servlet Mapping.
This mapping identifies a jsp page as having JSF content. If a
request comes to the server for foo.faces, the container will
send the request to the FacesServlet, which will expect a
corresponding foo.jsp page to exist containing the content.
-->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<!--
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
-->
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!--
Disallow direct access to the JSP pages that are
used for JSF. You must add a <url-pattern> entry
for each JSP page that corresponds to a faces page.
-->
<security-constraint>
<display-name>
Prevent access to raw JSP pages that are for JSF pages.
</display-name>
<web-resource-collection>
<web-resource-name>Raw-JSF-JSP-Pages</web-resource-name>
<!-- Add url-pattern for EACH raw JSP page -->
<url-pattern>/index.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<description>No roles, so no direct access</description>
</auth-constraint>
</security-constraint>
</web-app>
-----------------------------------------------------
index.jsp:
<!-- index.jsp -->
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Index</title></head>
<body>
<f:view>
<h2>This is a test</h2>
<p>
<h
</p>
</f:view>
</body>
</html>
----------------------------------------------------------
faces-config.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<!-- nothing relevant -->
</faces-config>
--------------------------------------------------------------
directory structure:
jsp/
index.jsp
WEB-INF/
classes/
faces-config.xml
lib/
web.xml
-----------------------------------------------------------
when I try to open http://hostname:port/app/faces/jsp/index.jsp
I get the 404 error: Requested resource is not available
Any help is appreciated, as I am going out of my mind!
Thanks,
C