`
8366
  • 浏览: 809041 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

struts1.2.9+spring2.0.6+hibernate3.0.5 整合开发的一个例子

阅读更多

一个小例子,看看struts1.2.9+spring2.0.6+hibernate3.0.5 是如何整合在一起进行javaweb开发的


一个简单的OA小系统,下面是预览图和项目结构





 

 

这个SSH整合的例子,用到了许多经典的整合技巧,能帮助初学者清晰的理解整合的步骤和技巧,我们也可以使用这个框架为模版,来搭建自己SSH的环境。


首先我列出关键的整合步骤


1.建立WEB项目的目录结构

   a.strtus的 ActionServlet 配置在web.xml 中

   b.将spring的监听器 配置在web.xml

   c.字符乱码过滤器 配置在web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/applicationContext.xml</param-value>
	</context-param>
	<listener>
		<listener-class>
			org.springframework.web.context.ContextLoaderListener
		</listener-class>
	</listener>

	<filter>
		<filter-name>Set Character Encoding</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>
		<filter-name>sitemesh</filter-name>
		<filter-class>
			com.opensymphony.module.sitemesh.filter.PageFilter
		</filter-class>
	</filter>

	<filter-mapping>
		<filter-name>sitemesh</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>Set Character Encoding</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<servlet>
		<servlet-name>action</servlet-name>
		<servlet-class>
			org.apache.struts.action.ActionServlet
		</servlet-class>
		<init-param>
			<param-name>config</param-name>
			<param-value>/WEB-INF/struts-config.xml</param-value>
		</init-param>
		<init-param>
			<param-name>debug</param-name>
			<param-value>3</param-value>
		</init-param>
		<init-param>
			<param-name>detail</param-name>
			<param-value>3</param-value>
		</init-param>
		<load-on-startup>0</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>action</servlet-name>
		<url-pattern>*.do</url-pattern>
	</servlet-mapping>
	<session-config>
		<session-timeout>120</session-timeout>
	</session-config>

	<!-- The Usual Welcome File List -->
	<welcome-file-list>
		<welcome-file>index.do</welcome-file>
	</welcome-file-list>
	<jsp-config>
		<taglib>
			<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
			<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
			<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
			<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
			<taglib-location>
				/WEB-INF/struts-nested.tld
			</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>/WEB-INF/struts-template.tld</taglib-uri>
			<taglib-location>
				/WEB-INF/struts-template.tld
			</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
			<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
		</taglib>

		<taglib>
			<taglib-uri>sitemesh-page</taglib-uri>
			<taglib-location>
				/WEB-INF/sitemesh-page.tld
			</taglib-location>
		</taglib>

		<taglib>
			<taglib-uri>sitemesh-decorator</taglib-uri>
			<taglib-location>
				/WEB-INF/sitemesh-decorator.tld
			</taglib-location>
		</taglib>
	</jsp-config>
	<welcome-file-list>
		<welcome-file>login.jsp</welcome-file>
	</welcome-file-list>
</web-app>

 

 

2.编写spring的配置文件 applicationContext.xml

 

  a. 配置数据源

  b.让spring来管理SessionFactory

  c.配置事务

  d.配置Hibernate 属性以及映射文件

  e.定义DAO和DAO代理

  f.根据需要配置AOP

  g.定义struts的配置

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>


	<!--  配置数据源 -->
	<bean id="dataSource"
		class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName">
			<value>com.mysql.jdbc.Driver</value>
		</property>
		<property name="url">
			<value>jdbc:mysql://localhost:3306/demo?useUnicode=true&amp;characterEncoding=utf-8</value>
		</property>
		<property name="username">
			<value>root</value>
		</property>
		<property name="password">
			<value>12345678</value>
		</property>
	</bean>


	<!-- 配置Hibernate -->
	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource">
			<ref local="dataSource" />
		</property>
		<property name="mappingResources">
			<list>
				<value>com/demo/hibernate/beans/User.hbm.xml</value>
				<value>com/demo/hibernate/beans/Address.hbm.xml</value>
				<value>com/demo/hibernate/beans/Schedule.hbm.xml</value>
				<value>com/demo/hibernate/beans/Worklog.hbm.xml</value>
				<value>com/demo/hibernate/beans/Sms.hbm.xml</value>
				<value>com/demo/hibernate/beans/Notice.hbm.xml</value>
				<value>com/demo/hibernate/beans/Meeting.hbm.xml</value>
			</list>
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">
					org.hibernate.dialect.MySQLDialect
				</prop>
				<prop key="hibernate.show_sql">true</prop>
				<prop key="hibernate.hbm2ddl.auto">update</prop>
			</props>
		</property>
	</bean>


	<!-- 配置事务 -->
	<bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>


	<!-- 定义DAO -->
	<bean id="userDAO" class="com.demo.hibernate.dao.UserDAO">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>
	<bean id="addressDAO" class="com.demo.hibernate.dao.AddressDAO">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>
	<bean id="scheduleDAO" class="com.demo.hibernate.dao.ScheduleDAO">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>
	<bean id="worklogDAO" class="com.demo.hibernate.dao.WorklogDAO">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>
	<bean id="smsDAO" class="com.demo.hibernate.dao.SmsDAO">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>
	<bean id="noticeDAO" class="com.demo.hibernate.dao.NoticeDAO">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>
	<bean id="meetingDAO" class="com.demo.hibernate.dao.MeetingDAO">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>


	<!-- 定义DAO代理 -->
	<bean id="UserDAOProxy"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager">
			<ref bean="transactionManager" />
		</property>
		<property name="target">
			<ref local="userDAO" />
		</property>
		<property name="transactionAttributes">
			<props>
				<prop key="insert*">PROPAGATION_REQUIRED</prop>
				<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
			</props>
		</property>
	</bean>
	<bean id="addressDAOProxy"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager">
			<ref bean="transactionManager" />
		</property>
		<property name="target">
			<ref local="addressDAO" />
		</property>
		<property name="transactionAttributes">
			<props>
				<prop key="insert*">PROPAGATION_REQUIRED</prop>
				<prop key="update*">PROPAGATION_REQUIRED</prop>
				<prop key="delete*">PROPAGATION_REQUIRED</prop>
				<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
			</props>
		</property>
	</bean>
	<bean id="scheduleDAOProxy"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager">
			<ref bean="transactionManager" />
		</property>
		<property name="target">
			<ref local="scheduleDAO" />
		</property>
		<property name="transactionAttributes">
			<props>
				<prop key="insert*">PROPAGATION_REQUIRED</prop>
				<prop key="update*">PROPAGATION_REQUIRED</prop>
				<prop key="delete*">PROPAGATION_REQUIRED</prop>
				<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
			</props>
		</property>
	</bean>
	<bean id="worklogDAOProxy"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager">
			<ref bean="transactionManager" />
		</property>
		<property name="target">
			<ref local="worklogDAO" />
		</property>
		<property name="transactionAttributes">
			<props>
				<prop key="insert*">PROPAGATION_REQUIRED</prop>
				<prop key="update*">PROPAGATION_REQUIRED</prop>
				<prop key="delete*">PROPAGATION_REQUIRED</prop>
				<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
			</props>
		</property>
	</bean>
	<bean id="smsDAOProxy"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager">
			<ref bean="transactionManager" />
		</property>
		<property name="target">
			<ref local="smsDAO" />
		</property>
		<property name="transactionAttributes">
			<props>
				<prop key="insert*">PROPAGATION_REQUIRED</prop>
				<prop key="update*">PROPAGATION_REQUIRED</prop>
				<prop key="delete*">PROPAGATION_REQUIRED</prop>
				<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
			</props>
		</property>
	</bean>
	<bean id="noticeDAOProxy"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager">
			<ref bean="transactionManager" />
		</property>
		<property name="target">
			<ref local="noticeDAO" />
		</property>
		<property name="transactionAttributes">
			<props>
				<prop key="insert*">PROPAGATION_REQUIRED</prop>
				<prop key="update*">PROPAGATION_REQUIRED</prop>
				<prop key="delete*">PROPAGATION_REQUIRED</prop>
				<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
			</props>
		</property>
	</bean>
	<bean id="meetingDAOProxy"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager">
			<ref bean="transactionManager" />
		</property>
		<property name="target">
			<ref local="meetingDAO" />
		</property>
		<property name="transactionAttributes">
			<props>
				<prop key="insert*">PROPAGATION_REQUIRED</prop>
				<prop key="update*">PROPAGATION_REQUIRED</prop>
				<prop key="delete*">PROPAGATION_REQUIRED</prop>
				<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
			</props>
		</property>
	</bean>


	<!-- 定义Struts配置 -->
	<bean name="/login" class="com.demo.struts.actions.LoginAction">
		<property name="userDAO">
			<ref local="userDAO" />
		</property>
	</bean>
	<bean name="/logout" class="com.demo.struts.actions.LogoutAction">
		<property name="userDAO">
			<ref local="userDAO" />
		</property>
	</bean>
	<bean name="/register"
		class="com.demo.struts.actions.RegisterAction">
		<property name="userDAO">
			<ref local="userDAO" />
		</property>
	</bean>

	<!-- 定义Struts配置:address -->
	<bean name="/address"
		class="com.demo.struts.actions.AddressAction">
		<property name="addressDAO">
			<ref local="addressDAO" />
		</property>
	</bean>
	<bean name="/address_add"
		class="com.demo.struts.actions.AddressAction">
		<property name="addressDAO">
			<ref local="addressDAO" />
		</property>
	</bean>
	<bean name="/address_edit"
		class="com.demo.struts.actions.AddressAction">
		<property name="addressDAO">
			<ref local="addressDAO" />
		</property>
	</bean>


	<!-- 定义Struts配置:schedule -->
	<bean name="/schedule"
		class="com.demo.struts.actions.ScheduleAction">
		<property name="scheduleDAO">
			<ref local="scheduleDAO" />
		</property>
	</bean>
	<bean name="/schedule_add"
		class="com.demo.struts.actions.ScheduleAction">
		<property name="scheduleDAO">
			<ref local="scheduleDAO" />
		</property>
	</bean>
	<bean name="/schedule_edit"
		class="com.demo.struts.actions.ScheduleAction">
		<property name="scheduleDAO">
			<ref local="scheduleDAO" />
		</property>
	</bean>

	<!-- 定义Struts配置:worklog -->
	<bean name="/worklog"
		class="com.demo.struts.actions.WorklogAction">
		<property name="worklogDAO">
			<ref local="worklogDAO" />
		</property>
	</bean>
	<bean name="/worklog_add"
		class="com.demo.struts.actions.WorklogAction">
		<property name="worklogDAO">
			<ref local="worklogDAO" />
		</property>
	</bean>
	<bean name="/worklog_edit"
		class="com.demo.struts.actions.WorklogAction">
		<property name="worklogDAO">
			<ref local="worklogDAO" />
		</property>
	</bean>

	<!-- 定义Struts配置:sms -->
	<bean name="/sms" class="com.demo.struts.actions.SmsAction">
		<property name="smsDAO">
			<ref local="smsDAO" />
		</property>
	</bean>
	<bean name="/sms_add" class="com.demo.struts.actions.SmsAction">
		<property name="smsDAO">
			<ref local="smsDAO" />
		</property>
	</bean>

	<!-- 定义Struts配置:notice -->
	<bean name="/notice" class="com.demo.struts.actions.NoticeAction">
		<property name="noticeDAO">
			<ref local="noticeDAO" />
		</property>
	</bean>
	<bean name="/notice_add"
		class="com.demo.struts.actions.NoticeAction">
		<property name="noticeDAO">
			<ref local="noticeDAO" />
		</property>
	</bean>
	<bean name="/notice_edit"
		class="com.demo.struts.actions.NoticeAction">
		<property name="noticeDAO">
			<ref local="noticeDAO" />
		</property>
	</bean>

	<!-- 定义Struts配置:meeting -->
	<bean name="/meeting"
		class="com.demo.struts.actions.MeetingAction">
		<property name="meetingDAO">
			<ref local="meetingDAO" />
		</property>
	</bean>
	<bean name="/meeting_add"
		class="com.demo.struts.actions.MeetingAction">
		<property name="meetingDAO">
			<ref local="meetingDAO" />
		</property>
	</bean>
	<bean name="/meeting_edit"
		class="com.demo.struts.actions.MeetingAction">
		<property name="meetingDAO">
			<ref local="meetingDAO" />
		</property>
	</bean>


	<!-- 配置拦截器 -->
	<bean name="logger" class="com.demo.spring.aop.LoggingInterceptor" />

	<!-- 配置拦截器代理 -->
	<bean name="loggingAutoProxy"
		class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
		<property name="beanNames">
			<list>
				<value>/login</value>
				<value>/register</value>
				<value>/address</value>
				<value>/address_add</value>
				<value>/address_edit</value>
				<value>/schedule</value>
				<value>/schedule_add</value>
				<value>/schedule_edit</value>
				<value>/worklog</value>
				<value>/worklog_add</value>
				<value>/worklog_edit</value>
				<value>/sms</value>
				<value>/sms_add</value>
				<value>/notice</value>
				<value>/notice_add</value>
				<value>/notice_edit</value>
				<value>/meeting</value>
				<value>/meeting_add</value>
				<value>/meeting_edit</value>
			</list>
		</property>
		<property name="interceptorNames">
			<list>
				<value>logger</value>
			</list>
		</property>
	</bean>

</beans>

 


3.配置 struts.xml ,使用spring的处理器(controller)来 处理用户的请求

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">

<struts-config>
	<!-- 
		<data-sources>
		<data-source type="org.apache.commons.dbcp.BasicDataSource">
		<set-property property="driverClassName"
		value="org.gjt.mm.mysql.Driver" />
		<set-property property="url"
		value="jdbc:mysql://localhost:3306/demo" />
		<set-property property="username" value="root" />
		<set-property property="password" value="" />
		<set-property property="maxActive" value="10" />
		<set-property property="maxWait" value="5000" />
		<set-property property="defaultAutoCommit" value="false" />
		<set-property property="defaultReadOnly" value="false" />
		<set-property property="validationQuery"
		value="SELECT COUNT(*) FROM user" />
		</data-source>
		</data-sources>
	-->
	<form-beans>
		<form-bean name="pageForm"
			type="com.demo.struts.forms.PageForm">
		</form-bean>
		<form-bean name="loginForm"
			type="com.demo.struts.forms.LoginForm">
		</form-bean>
		<form-bean name="registerForm"
			type="com.demo.struts.forms.RegisterForm">
		</form-bean>
		<form-bean name="addressForm"
			type="com.demo.struts.forms.AddressForm">
		</form-bean>
		<form-bean name="scheduleForm"
			type="com.demo.struts.forms.ScheduleForm">
		</form-bean>
		<form-bean name="worklogForm"
			type="com.demo.struts.forms.WorklogForm">
		</form-bean>
		<form-bean name="smsForm"
			type="com.demo.struts.forms.SmsForm">
		</form-bean>
		<form-bean name="noticeForm"
			type="com.demo.struts.forms.NoticeForm">
		</form-bean>
		<form-bean name="meetingForm"
			type="com.demo.struts.forms.MeetingForm">
		</form-bean>
	</form-beans>

	<global-exceptions />
	<global-forwards>
		<forward name="welcome" path="/welcome.do" />
		<forward name="login" path="/login.do" />
		<forward name="index" path="/login.jsp" />
	</global-forwards>

	<action-mappings>
		<action path="/index" forward="/login.jsp" />
		<action path="/welcome" forward="/welcome.jsp" />

		<action path="/login" name="loginForm" scope="request"
			
			input="/login.jsp">
			<forward name="success" path="/welcome.jsp" />
			<forward name="failure" path="/login.jsp" />
		</action>

		<action path="/logout"
			type="org.springframework.web.struts.DelegatingActionProxy">
			<forward name="logout" path="/login.jsp" />
		</action>

		<action path="/register" parameter="method" name="registerForm"
			scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy"
			input="/register.jsp">
			<forward name="success" path="/login.jsp" />
			<forward name="failure" path="/register.jsp" />
		</action>

		<!-- 通讯录模块 -->
		<action path="/address" parameter="method" name="pageForm"
			scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy">
			<forward name="list" path="/address.jsp" />
		</action>
		<action path="/address_add" parameter="method"
			name="addressForm" scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy"
			input="/address_add.jsp">
			<forward name="list" path="/address.jsp" />
			<forward name="add" path="/address_add.jsp" />
		</action>
		<action path="/address_edit" parameter="method"
			name="addressForm" scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy"
			input="/address_edit.jsp">
			<forward name="list" path="/address.jsp" />
			<forward name="edit" path="/address_edit.jsp" />
		</action>

		<!-- 日程安排模块 -->
		<action path="/schedule" parameter="method" name="pageForm"
			scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy">
			<forward name="list" path="/schedule.jsp" />
		</action>
		<action path="/schedule_add" parameter="method"
			name="scheduleForm" scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy"
			input="/schedule_add.jsp">
			<forward name="list" path="/schedule.jsp" />
			<forward name="add" path="/schedule_add.jsp" />
		</action>
		<action path="/schedule_edit" parameter="method"
			name="scheduleForm" scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy"
			input="/schedule_edit.jsp">
			<forward name="list" path="/schedule.jsp" />
			<forward name="edit" path="/schedule_edit.jsp" />
		</action>

		<!-- 工作日志 -->
		<action path="/worklog" parameter="method" name="pageForm"
			scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy">
			<forward name="list" path="/worklog.jsp" />
		</action>
		<action path="/worklog_add" parameter="method"
			name="worklogForm" scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy"
			input="/worklog_add.jsp">
			<forward name="list" path="/worklog.jsp" />
			<forward name="add" path="/worklog_add.jsp" />
		</action>
		<action path="/worklog_edit" parameter="method"
			name="worklogForm" scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy"
			input="/worklog_edit.jsp">
			<forward name="list" path="/worklog.jsp" />
			<forward name="edit" path="/worklog_edit.jsp" />
		</action>

		<!-- 短消息管理 -->
		<action path="/sms" parameter="method" name="pageForm"
			scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy">
			<forward name="list" path="/sms.jsp" />
		</action>
		<action path="/sms_add" parameter="method" name="smsForm"
			scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy"
			input="/sms_add.jsp">
			<forward name="list" path="/sms.jsp" />
			<forward name="add" path="/sms_add.jsp" />
		</action>

		<!-- 公告管理 -->
		<action path="/notice" parameter="method" name="pageForm"
			scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy">
			<forward name="list" path="/notice.jsp" />
		</action>
		<action path="/notice_add" parameter="method" name="noticeForm"
			scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy"
			input="/notice_add.jsp">
			<forward name="list" path="/notice.jsp" />
			<forward name="add" path="/notice_add.jsp" />
		</action>
		<action path="/notice_edit" parameter="method" name="noticeForm"
			scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy"
			input="/notice_edit.jsp">
			<forward name="list" path="/notice.jsp" />
			<forward name="edit" path="/notice_edit.jsp" />
		</action>

		<!-- 会议管理 -->
		<action path="/meeting" parameter="method" name="pageForm"
			scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy">
			<forward name="list" path="/meeting.jsp" />
		</action>
		<action path="/meeting_add" parameter="method"
			name="meetingForm" scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy"
			input="/meeting_add.jsp">
			<forward name="list" path="/meeting.jsp" />
			<forward name="add" path="/meeting_add.jsp" />
		</action>
		<action path="/meeting_edit" parameter="method"
			name="meetingForm" scope="request"
			type="org.springframework.web.struts.DelegatingActionProxy"
			input="/meeting_edit.jsp">
			<forward name="list" path="/meeting.jsp" />
			<forward name="edit" path="/meeting_edit.jsp" />
		</action>

	</action-mappings>

		 
		<controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor" />
	

	<message-resources
		parameter="com.demo.struts.resources.ApplicationResources" />

	<!-- 
		<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
			<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
		</plug-in>
-->

</struts-config>

 


详细的代码请下载附件中的项目,用sql脚本,建立库和表已经数据,将项目放在TOMCat下,来验证



 

分享到:
评论

相关推荐

    Struts2.1.6+Spring2.5.6+Hibernate3.3.1整合

    在本文中,我们将详细介绍如何将Struts2.1.6、Spring2.5.6以及Hibernate3.3.1进行整合,并构建一个简单的MVC应用。通过这个过程,读者将了解到这三种框架的基本配置、集成方法以及常见问题的解决办法。 #### 一、...

    Struts+Spring+iBatis

    Struts 1.2.9 + Spring 2.5.6 + iBATIS 2.3.4 + MySQL 3.1 + Tomcat 5.5.26 &gt; 开发环境: * MyEclipse、JDK1.5、J2EE1.4 &gt; 使用技术: * Struts1、Spring、iBATIS &gt; 运行环境: * Window + Tomcat 5.5.26 + ...

    struts2+spring3+hibernate3+jquery+springside 做一个OA2

    标题 "struts2+spring3+hibernate3+jquery+springside 做一个OA2" 提供了一个综合的Web开发框架组合,用于构建一个办公自动化(OA)系统。这个系统基于以下技术栈: 1. **Struts2**: Struts2是一个Java Web MVC...

    struts1.2.9+hibernate3.3.1完整数据库表增删改查示例

    struts1.2.9,Hibernate3.3.1,struts-tags,JSTL标签库+EL,对数据库表(test.userinfo)增删改查的完整示例. 未用Eclipse或MyEclipse,几乎纯手工实现,含所需库文件. 欢迎大家下载部署,学习. 2009-12-15

    struts2.1.6+spring2.0+hibernate3.2常用配置包

    最近温习ssh2整合编程,顺便浏览下struts2有什么更新的消息,下载了新版本的struts2的2.1.8.1版,使用的是MyEclipse8.0开发,但是问题就随之而来了。MyEclipse8.0中自带的struts2版本是2.1.6,spring版本有2.0,2.5...

    Struts2.1.8+Spring3.0.2+hibernate3.5.1

    标题 "Struts2.1.8+Spring3.0.2+hibernate3.5.1" 提供了一个经典的Java Web开发中的技术栈组合,它由三个主要框架构成:Struts2作为MVC(模型-视图-控制器)框架,Spring作为依赖注入和企业服务容器,以及Hibernate...

    struts1.2.9+hibernate3框架开发的WEB应用程序(小单位新闻发布系统)

    适合小单位应用的新闻发布系统采用 sql server2000数据库系统,也可以作为教学的小例子。系统只需要初始化管理员数据库,用户信息,新闻版块,及用户权限,由管理员登陆后初始化。登陆用户可查看相应权限新闻。管理...

    struts1.2.9.rar

    Struts 1.2.9 是一个非常经典的Java Web开发框架,由Apache软件基金会的Jakarta项目维护。这个版本发布于很久以前,但它仍然是许多遗留系统的基础,因为它的稳定性和丰富的功能集。Struts 1引入了MVC(模型-视图-...

    Struts 1.2.9 jar 包及原文件

    Struts 1.2.9 是一个非常经典的Java Web开发框架版本,主要用于构建基于MVC(Model-View-Controller)模式的应用程序。该框架由Apache软件基金会开发并维护,为开发者提供了一种组织应用程序结构、处理HTTP请求以及...

    MVC框架struts1.2.9

    Struts 1.2.9 是一个经典的Java Web开发框架,属于MVC(Model-View-Controller)架构模式的一种实现。MVC模式是软件工程中用于分隔应用程序数据逻辑、用户界面和应用流程控制的常见设计模式。在这个框架中,模型负责...

    MVC框架struts1.2.9源码

    Struts1.2.9是Apache软件基金会的一个开源项目,它是Model-View-Controller(MVC)设计模式在Java Web应用程序中的实现。这个框架的主要目标是简化开发过程,提高代码组织性和可维护性,使开发者能够更高效地构建...

    struts1.2.9 jar包

    Struts1.2.9是Apache软件基金会的Jakarta项目中的一个核心框架,主要用于构建基于Java的Web应用程序。这个框架是MVC(Model-View-Controller)设计模式的一个实现,它帮助开发者在Java EE平台上创建结构清晰且易于...

    struts1.2.9包下载

    Struts 1.2.9是Struts 1.x系列中的一个版本,它是一个开源的MVC(Model-View-Controller)框架,用于简化Java Web应用程序的开发。Struts框架最初由Gavin King创建,并被Apache Software Foundation所维护。自发布...

    struts1.2.9的jar包

    Struts1.2.9是Apache软件基金会的Jakarta项目中的一个开源框架,主要用于构建基于Java的Web应用程序。这个框架的核心是MVC(Model-View-Controller)设计模式,它帮助开发者将业务逻辑、数据表示和用户界面进行分离...

    struts1.2.9完整Jar包

    Struts1.2.9是该框架的一个版本,发布于2007年,它在Struts1系列中具有广泛的使用,尤其在那个时期的企业应用开发中占据了重要地位。 Struts1的核心组件包括: 1. **ActionServlet**:这是Struts框架的控制器组件...

    struts1.2.9-src.zip

    Struts是Apache软件基金会下的一个开源项目,是一个基于MVC(Model-View-Controller)设计模式的Java Web应用程序框架。这个“struts1.2.9-src.zip”压缩包包含了Struts框架的1.2.9版本的源代码,允许开发者深入理解...

    struts1.2.9

    Struts 1.2.9 是一个非常重要的Java Web开发框架,由Apache软件基金会开发并维护。这个版本的Struts是Struts 1系列中的一个稳定版本,它为开发者提供了构建MVC(Model-View-Controller)架构的应用程序的能力。在...

    struts1.2.9 src+bin

    Struts 1.2.9 是一个非常经典的Java Web开发框架,由Apache软件基金会开发,主要用于构建基于MVC(Model-View-Controller)设计模式的Web应用程序。此完全版本包含了`src`和`bin`两个关键部分,为开发者提供了源码和...

Global site tag (gtag.js) - Google Analytics