Spring Struts (Web)
来源:互联网 发布:洲际酒店 知乎 编辑:程序博客网 时间:2024/05/17 23:02
一 概念
本方式是使用拦截的方式是Spring和Struts结合在一起
二 在web.xml配置
<context-param> //必须放在第一位
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext*.xml</param-value> ///WEB-INF/applicationContext开头的位spring配置文件
</context-param>
<listener> // 主要监听器
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<filter> //spring中的编码处理方式
<filter-name>encodeFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodeFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
三 struts-config.xml 配置
由 <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
变为
<controller processorClass="org.springframework.web.struts.DelegatingTilesRequestProcessor"/>
四 struts-config.xml <action> 配置不变(相对插件方式来说)整个struts-config.xml到此不需要变化了
五 spring 配置
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
</bean>
<bean id="baseDaoProxy" abstract="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref local="transactionManager"/> //没有target属性了
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<bean id="studentDaoImp" class="com.myapp.study.dao.StudentDaoImp">
</bean>
<bean id="studentDaoProxy" parent="baseDaoProxy">
<property name="target"> //添加target属性了
<ref bean="studentDaoImp"/>
</property>
</bean>
<bean name="/doLogin,/doRegist,/doUpdate" class="com.myapp.study.ui.StudentAction">
<property name="studentDao">
<ref local="studentDaoProxy"/>
</property>
</bean>
</beans>
- Spring Struts (Web)
- web application:struts(view),spring
- 使用struts+spring+hibernate 组装web应用
- 使用struts+spring+hibernate 组装web应用
- 使用struts+spring+hibernate 组装web应用
- 使用struts+spring+hibernate 组装web应用
- 使用struts+spring+hibernate 组装web应用
- 使用struts+spring+hibernate 组装web应用
- 使用struts+spring+hibernate 组装web应用
- 使用struts+spring+hibernate 组装web应用
- 使用struts+spring+hibernate 组装web应用
- 使用struts+spring+hibernate 组装web应用
- 使用struts+spring+hibernate 组装web应用
- 使用struts+spring+hibernate 组装web应用
- 用struts+spring+hibernate组装web应用
- 用struts+spring+hibernate组装web应用
- 使用struts+spring+hibernate 组装web应用
- 使用struts+spring+hibernate 组装web应用
- 采用JAX-WS Annotated Services from Java+JAXB发布获取web service
- Spring Hibernater
- 阴阳历转换
- Spring JDBC
- 1.4年编程时间---整理
- Spring Struts (Web)
- Spring Struts(插件)
- log4j包
- 我国软件架构师地位如何
- 概念
- 配置
- 资源文件
- 白话软件架构师
- 面试经典十六题