您好,欢迎访问一九零五行业门户网

web.xml的配置

这次给大家带来web.xml的配置,web.xml配置注意事项有哪些,下面就是实战案例,一起来看一下。
<!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> <display-name>archetype created web application</display-name> <!-- 定位applicatioincontext.xml路径 --> <context-param> <param-name>contextconfiglocation</param-name> <param-value>classpath:applicationcontext.xml</param-value> </context-param> <filter> <filter-name>springencoding</filter-name> <filter-class>org.springframework.web.filter.characterencodingfilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>utf-8</param-value> </init-param> <init-param> <param-name>forceencoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter> <filter-name>opensessioninview</filter-name> <filter-class>org.springframework.orm.hibernate3.support.opensessioninviewfilter</filter-class> <init-param> <param-name>sessionfactorybeanname</param-name> <param-value>sessionfactory</param-value> </init-param> </filter> <filter> <filter-name>sessionfilter</filter-name> <filter-class>com.troyforever.example.filter.sessionfilter</filter-class> </filter> <filter-mapping> <filter-name>springencoding</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>opensessioninview</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>sessionfilter</filter-name> <url-pattern>/admin/*</url-pattern> </filter-mapping> <!-- 加载applicationcontext.xml配置文件 --> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> <servlet> <servlet-name>example</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>example</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app>
相信看了本文案例你已经掌握了方法,更多精彩请关注其它相关文章!
相关阅读:
spring的mvc配置
hibernate的映射文件详解
以上就是web.xml的配置的详细内容。
其它类似信息

推荐信息