java 从零开始,学习笔记之基础入门(Struts2_Spring_整合)(四十一)

2014-11-24 02:31:32 · 作者: · 浏览: 0

Struts-Spring

Struts-Spring整合配置图

\


Spring配置文件

applicationContext.xml

"1.0" encoding="UTF-8" >

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">

"applicationContext-dao.xml"/>

"applicationContext-service.xml"/>

"applicationContext-action.xml"/>

applicationContext-action.xml

"1.0" encoding="UTF-8" >

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">

"groupmaction" class= "com.softeem.action.GroupManagerAction">

"service" ref= "gservice">

applicationContext-service.xml

"1.0" encoding="UTF-8" >

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">

"gservice" class= "com.softeem.service.impservice.GroupService">

"dao" ref= "groopservice">

applicationContext-dao.xml

"1.0" encoding="UTF-8" >

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">

"groopservice" init-method= "init" destroy-method= "destroy" class= "com.softeem.dao.impdao.GroupDAO" scope= "prototype">

"name" value= "产品研发组">

"int" value= "1000">

Struts配置文件

Struts.xml

"1.0" encoding="UTF-8" >

"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"

"http://struts.apache.org/dtds/struts-2.0.dtd">

"group" extends= "struts-default">

"groupadd" class= "groupmaction">

"success">success. jsp

Struts.properties

struts.action.extension=do

struts.objectFactory=spring

struts.objectFactory.spring.autowire=name

整合需导入的插件包

\

Web.xml配置文件

Web.xml

"1.0" encoding="UTF-8" >

"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">

index.jsp

contextConfigLocation

classpath*:applicationContext-*. xml

org.springframework.web.context.ContextLoaderListener

filterDispatcher

org.apache.struts2.dispatcher.FilterDispatcher

filterDispatcher

/*