hibernate与struts、spring三大框架整合中web-xml的使用介绍

更新时间:2023-06-05 14:39:01 阅读量: 实用文档 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

hibernate与struts、spring三大框架整合中web-xml的使用介绍

<?xml version="1.0" encoding="UTF-8"?>

<web-app version="2.4"

xmlns="/xml/ns/j2ee"

xmlns:xsi="/2001/XMLSchema-instance"

xsi:schemaLocation="/xml/ns/j2ee

/xml/ns/j2ee/web-app_2_4.xsd">

<welcome-file-list>

<welcome-file>index.jsp</welcome-file>

</welcome-file-list>

<!--配置Struts-->

<servlet>

<servlet-name>action</servlet-name>

<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

<init-param>

<param-name>config</param-name>

<param-value>/WEB-INF/struts-config.xml</param-value>

</init-param>

<init-param>

<param-name>debug</param-name>

<param-value>2</param-value>

</init-param>

<init-param>

<param-name>detail</param-name>

<param-value>2</param-value>

</init-param>

<load-on-startup>2</load-on-startup>

</servlet>

<!-- 日期转换-->

<servlet>

<servlet-name>initServlet</servlet-name>

<servlet-class>com.bjsxt.oa.web.InitServlet</servlet-class>

<load-on-startup>3</load-on-startup>

</servlet>

<!-- Standard Action Servlet Mapping -->

<servlet-mapping>

<servlet-name>action</servlet-name>

<url-pattern>*.do</url-pattern>

</servlet-mapping>

<!-- 指明Spring的application文件的位置 -->

<context-param>

hibernate与struts、spring三大框架整合中web-xml的使用介绍

<param-name>contextConfigLocation</param-name>

<param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>

</context-param>

<!-- 启动SPring-->

<listener>

<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>

<!-- 处理中文乱码-->

<filter>

<filter-name>Spring character encoding filter</filter-name>

<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param>

<param-name>encoding</param-name>

<param-value>GBK</param-value>

</init-param>

</filter>

<filter-mapping>

<filter-name>Spring character encoding filter</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>

<!-- spring封装hibernate后,提供启动、关闭session, 来处理hibernate抛出的异常--> <filter>

<filter-name>hibernateFilter</filter-name>

<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> </filter>

<filter-mapping>

<filter-name>hibernateFilter</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>

<filter>

<filter-name>pagerFilter</filter-name>

<filter-class>com.bjsxt.oa.web.PagerFilter</filter-class>

</filter>

<filter-mapping>

<filter-name>pagerFilter</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>

<servlet>

<servlet-name>dwr-invoker</servlet-name>

hibernate与struts、spring三大框架整合中web-xml的使用介绍

<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class> <init-param>

<param-name>debug</param-name>

<param-value>true</param-value>

</init-param>

</servlet>

<servlet-mapping>

<servlet-name>dwr-invoker</servlet-name>

<url-pattern>/dwr/*</url-pattern>

</servlet-mapping>

</web-app>

本文来源:https://www.bwwdw.com/article/kpe1.html

Top