一. 搭建struts-2.3.1.2
1.Jar包:
2.配置struts2.3的过滤器,l位置
l
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0"
xmlns="java.sun/xml/ns/javaee"
xmlns:xsi="/2001/XMLSchema-instance"
xmlns:web="java.sun/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="java.sun/xml/ns/javaee
java.sun/xml/ns/javaee/web-app_3_0.xsd">
<!-- 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>
</web-app>
4.配置l
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"/dtds/struts-2.3.dtd">
<struts>
<package name="ssh" extends="struts-default,json-default,jfreechart-default,spring-default">
<action name="login" class="loginAction">
<result name="ok">/loginOk.jsp</result>
<result name="error">/loginError.jsp</result>
</action>
</spring怎么读取jar文件package>
</struts>
5.测试struts
二.整合Spring 3.1.1和Struts-2.3.1.2
1.jar包
在配置好的strutsjar的基础上,添加额外Struts jar包:struts2-spring-plugin-2.3.1.2.jar
commons-logging-1.1.1.jar
Spring的jar包:
-3.1.1.RELEASE.jar
t-3.1.1.RELEASE.jar
org.springframework.beans-3.1.1.RELEASE.jar
org.springframework.asm-3.1.1.RELEASE.jar
pression-3.1.1.RELEASE.jar
org.springframework.web-3.1.1.RELEASE.jar
l
<?xml version="1.0" encoding="UTF-8"?>
web-app id="WebApp_ID" version="3.0"
xmlns="java.sun/xml/ns/javaee"
xmlns:xsi=/2001/XMLSchema-instance
xmlns:web="java.sun/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="java.sun/xml/ns/javaee
java.sun/xml/ns/javaee/web-app_3_0.xsd">
<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>
<listener>
<listener-class>org.springframework.t.ContextLoaderListener</listener-class>
</listener>
<!-- 告知spring config location 的存储位置 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
</web-app>
3.配置spring
l
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="/schema/beans"
xmlns:xsi="/2001/XMLSchema-instance" xmlns:p="/schema/p"
xmlns:tx="/schema/tx" xmlns:context="/schema/context"
xsi:schemaLocation="/schema/beans
/schema/beans/spring-beans-3.0.xsd
/schema/tx
/schema/tx/spring-tx-3.0.xsd
/schema/aop
/schema/aop/spring-aop-3.0.xsd
/schema/context
/schema/context/spring-context-3.0.xsd">
<context:annotation-config />
<context:component-scan base-package="l" />
</beans>
三.整合Hibernate4.1.1
1.jar包
添加Hibernate jar文件
Hibernate压缩包中的
lib/required/
antlr-2.7.7.jar
dom4j-1.6.1.jar
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-core-4.1.1.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
javassist-3.15.0-GA.jar
jboss-logging-3.1.0.GA.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
lib/jpa/
hibernate-entitymanager-4.1.1.Final.jar
lib/optional/c3p0/
hibernate-c3p0-4.1.1.Final.jar
c3p0-0.9.1.jar
Spring中的jar文件
org.springframework.aop-3.1.1.RELEASE.jar
org.springframework.jdbc-3.1.1.RELEASE.jar
-3.1.1.RELEASE.jar
ansaction-3.1.1.RELEASE.jar
其他的Spring支持文件
aopalliance.jar -- AOP要用到的jar包
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论