使用Tomcat和Eclipse的第一个JSF程序出错
我是Java和JSF的新手。我正在使用EclipseIndigo、Tomcat6.0.3和JSF2.0。Iam使用Maven并将wars部署到服务器 我在Eclipse中配置了服务器,通常在Localhost:8080中获得apache页面 但是当我尝试访问localhost:8080/ContactFormJSF/之类的页面时,我得到的消息如下使用Tomcat和Eclipse的第一个JSF程序出错,eclipse,jsf,maven,tomcat,Eclipse,Jsf,Maven,Tomcat,我是Java和JSF的新手。我正在使用EclipseIndigo、Tomcat6.0.3和JSF2.0。Iam使用Maven并将wars部署到服务器 我在Eclipse中配置了服务器,通常在Localhost:8080中获得apache页面 但是当我尝试访问localhost:8080/ContactFormJSF/之类的页面时,我得到的消息如下 HTTP Status 404 - /ContactFormJSF/ type Status report message /ContactFormJ
HTTP Status 404 - /ContactFormJSF/
type Status report
message /ContactFormJSF/
description The requested resource (/ContactFormJSF/) is not avilable.
这是Adduser.xhtml中的代码
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>JSF 2.0 Hello World</title>
</h:head>
<h:body>
<h3>JSF 2.0 Hello World Example - hello.xhtml</h3>
</h:body>
</html>
检查以下情况
WEB-INF/lib
目录下插入的所需JAR(强烈建议)servlet
是否已映射到Web.xml
URL
模式我已经在上面添加了我的web.xml,JAR在lib文件夹中,iam使用的url是localhost:8080/ContactFormJSF/have-look:。这应该对您有所帮助。@Khirthan..您的
web.xml
配置看起来是正确的。您缺少jar
的某些部分。确保WEB-INF/lib
@kark下所需的jar我有jsf的所有jar,即jsf-impl.jar、jsf-api.jar、jstl.jar、commons-beanutils-1.7.0.jar、commons-chain-1.1.jar、commons-collections.jar、commons-logging-1.0.4.jar、commons-digester-1.8.jar。我应该添加除此之外的任何内容吗?我不是手动卸下JAR,我只是在服务器中部署最终War输出。我的pom.xml有很多包含插件、存储库和依赖项的内容。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>AddUser.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<session-config>
<session-timeout>15</session-timeout>
</session-config>
</web-app>