ssh框架的整合(struts-2.5.5+spring-4.3.4+hibernate-5.2.4)

来源:互联网 发布:ios5.0.1软件下载 编辑:程序博客网 时间:2024/06/04 22:11
ssh框架的整合(struts-2.5.5+spring-4.3.4+hibernate-5.2.4)1.jdk-1.8 tomcat7的环境下2.创建web项目3.导包(struts+spring+hibernate4.src创建struts.xml spring.xml(applicationContext.xml)    struts.xml头添加几个常用属性(可不加)        <?xml version="1.0" encoding="UTF-8" ?>        <!DOCTYPE struts PUBLIC                        "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"                        "http://struts.apache.org/dtds/struts-2.5.dtd">        <struts>                <!-- 禁用动态方法访问 -->               <constant name="struts.enable.DynamicMethodInvocation" value="false" />               <!-- 配置成开发模式 -->               <constant name="struts.devMode" value="true" />        </struts>    spring.xml        <?xml version="1.0" encoding="UTF-8" ?>        <beans xmlns="http://www.springframework.org/schema/beans"               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"               xmlns:aop="http://www.springframework.org/schema/aop"               xmlns:context="http://www.springframework.org/schema/context"               xmlns:tx="http://www.springframework.org/schema/tx"               xsi:schemaLocation="http://www.springframework.org/schema/beans                http://www.springframework.org/schema/beans/spring-beans.xsd                http://www.springframework.org/schema/context                http://www.springframework.org/schema/context/spring-context.xsd                http://www.springframework.org/schema/aop                http://www.springframework.org/schema/aop/spring-aop.xsd                http://www.springframework.org/schema/tx                http://www.springframework.org/schema/tx/spring-tx.xsd">        </beans>5.配置web.xml    5.1 添加struts2过滤器        <filter>            <filter-name>struts2</filter-name>            <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>        </filter>        <filter-mapping>            <filter-name>struts2</filter-name>            <url-pattern>/*</url-pattern>        </filter-mapping>    5.2 注册spring监听器        <listener>            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>        </listener>        <context-param>            <param-name>contextConfigLocation</param-name>            <param-value>classpath*:spring.xml</param-value>        </context-param>
0 0
原创粉丝点击