java 从零开始,学习笔记之基础入门<Struts2_Spring_整合>(四十一)
2014-02-19 09:43
1101 查看
Struts-Spring
Struts-Spring整合配置图
Spring配置文件
Struts配置文件
整合需导入的插件包
Web.xml配置文件
Struts-Spring整合配置图
Spring配置文件
applicationContext.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:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <import resource="applicationContext-dao.xml"/> <import resource="applicationContext-service.xml"/> <import resource="applicationContext-action.xml"/> </beans> |
applicationContext-action.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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean name="groupmaction" class="com.softeem.action.GroupManagerAction"> <property name="service" ref="gservice"> </property> </bean> </beans> |
applicationContext-service.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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean name="gservice" class="com.softeem.service.impservice.GroupService"> <property name="dao" ref="groopservice"> </property> </bean> </beans> |
applicationContext-dao.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:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean name="groopservice" init-method="init" destroy-method="destroy" class="com.softeem.dao.impdao.GroupDAO" scope="prototype"> <property name="name" value="产品研发组"> </property> <constructor-arg type="int" value="1000"></constructor-arg> </bean> </beans> |
Struts配置文件
Struts.xml |
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="group" extends="struts-default"> <action name="groupadd" class="groupmaction"> <result name="success">success.jsp</result> </action> </package> </struts> |
Struts.properties |
struts.action.extension=do struts.objectFactory=spring struts.objectFactory.spring.autowire=name |
整合需导入的插件包
Web.xml配置文件
Web.xml |
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:applicationContext-*.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <filter> <filter-name>filterDispatcher</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>filterDispatcher</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app> |
相关文章推荐
- java 从零开始,学习笔记之基础入门<Struts2_实战演练(中)>(三十九)
- java 从零开始,学习笔记之基础入门<Struts2_实战演练(上)>(三十八)
- java 从零开始,学习笔记之基础入门<Struts2_实战演练(下)>(四十)
- java 从零开始,学习笔记之基础入门<三大框架整合>(四十二)
- java 从零开始,学习笔记之基础入门<SQL_Server_视图_函数_存储过程_触发器等>(二十三)
- java 从零开始,学习笔记之基础入门<SQL_Server>(二十一)
- java 从零开始,学习笔记之基础入门<封装类>(十一)
- java 从零开始,学习笔记之基础入门<抽象类_接口_多态>(十三)
- java 从零开始,学习笔记之基础入门<网络编程_带QQ模拟功能>(二十)
- java 从零开始,学习笔记之基础入门<Oracle_查询>(三十四)
- java 从零开始,学习笔记之基础入门<线程及实例分析>(十九)
- java 从零开始,学习笔记之基础入门<javascript>(三十)
- java 从零开始,学习笔记之基础入门<tomcat>(二十五)
- java 从零开始,学习笔记之基础入门<正则表达式>(三十一)
- java 从零开始,学习笔记之基础入门<数据类型的转换>(五)
- [原]java专业程序代写(qq:928900200),学习笔记之基础入门<Struts2_实战演练(上)>(三十八)
- java 从零开始,学习笔记之基础入门<集合>(十六)
- java 从零开始,学习笔记之基础入门<IO流>(十八)
- java 从零开始,学习笔记之基础入门<Oracle_基础>(三十三)
- java 从零开始,学习笔记之基础入门<Oracle_函数_触发器_游标_存储过程_视图>(三十五)