本文介绍了整合了jsf2.0和spring 3.1以及hibernate 4.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想整合jsf2.0和spring 3.1和hibernate 4.1。但tomcat有错误404:description所请求的资源(/jsfspringhiber/page/default.jsf)不可用。出了什么问题?
以下是我的web.xml:
<?xml version =1.0encoding =UTF-8?>
< web-app xmlns:xsi =http://www.w3.org/2001/XMLSchema-instance
xmlns =http://java.sun.com/xml/ns / javaee
xmlns:web =http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
xsi:schemaLocation =http://java.sun .com / xml / ns / javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsdversion =3.0>
< display-name> jsfspringhiber< / display-name>
< listener>
< listener-class>
org.springframework.web.context.ContextLoaderListener
< / listener-class>
< / listener>
< listener>
< listener-class>
org.springframework.web.context.request.RequestContextListener
< / listener-class>
< / listener>
< context-param>
< param-name> javax.faces.PROJECT_STAGE< / param-name>
<参数值>开发< /参数值>
< / context-param>
< welcome-file-list>
< welcome-file> faces / default.xhtml< / welcome-file>
< / welcome-file-list>
< servlet>
< servlet-name> Faces Servlet< / servlet-name>
< servlet-class> javax.faces.webapp.FacesServlet< / servlet-class>
1< / load-on-startup>
< / servlet>
<! - 使用JSF映射这些文件 - >
< 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> *。jsf< / url-pattern>
< / servlet-mapping>
< 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> *。xhtml< / url-pattern>
< / servlet-mapping>
< / web-app>
解决方案
我使用maven。正确的答案是
的结构是:
i want to integrate jsf2.0 and spring 3.1 and hibernate 4.1. but tomcat has error 404:description The requested resource (/jsfspringhiber/page/default.jsf) is not available.what is wrong?following is my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>jsfspringhiber</display-name>
<!-- Add Support for Spring -->
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<!-- Change to "Production" when you are ready to deploy -->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<!-- Welcome page -->
<welcome-file-list>
<welcome-file>faces/default.xhtml</welcome-file>
</welcome-file-list>
<!-- 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>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<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>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>
解决方案
i use maven. the correct answer is here.the structure is:
这篇关于整合了jsf2.0和spring 3.1以及hibernate 4.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!