`

SSH集成整合

 
阅读更多

一、Spring配置文件 

 

<?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"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
	http://www.springframework.org/schema/aop 
	http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 
	http://www.springframework.org/schema/tx 
	http://www.springframework.org/schema/tx/spring-tx-3.0.xsd ">
	<import resource="applicationContext-dao.xml" />
	<import resource="applicationContext-service.xml" />
	<import resource="applicationContext-action.xml" />
	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver">
		</property>
		<property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:min">
		</property>
		<property name="username" value="CinemaSystem"></property>
		<property name="password" value="CinemaSystem"></property>
	</bean>
	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource">
			<ref bean="dataSource" />
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">
					org.hibernate.dialect.Oracle9Dialect
				</prop>
				
					<!--<prop key="hibernate.show_sql">true</prop> <prop
					key="hibernate.format_sql">true</prop>
				
			--></props>
		</property>
		<property name="mappingResources">
			<list>
				<value>com/jbit/cinema/entity/Activity.hbm.xml</value>
				<value>com/jbit/cinema/entity/Movie.hbm.xml</value>
				<value>com/jbit/cinema/entity/Orders.hbm.xml</value>
				<value>com/jbit/cinema/entity/Pwdprotect.hbm.xml</value>
				<value>com/jbit/cinema/entity/Timetable.hbm.xml</value>
				<value>com/jbit/cinema/entity/Users.hbm.xml</value>
				<value>com/jbit/cinema/entity/Salle.hbm.xml</value>
				<value>com/jbit/cinema/entity/Seat.hbm.xml</value>
				<value>
					com/jbit/cinema/entity/Onlinecinema.hbm.xml
				</value>
				<value>com/jbit/cinema/entity/Reply.hbm.xml</value>
				<value>com/jbit/cinema/entity/Board.hbm.xml</value>
				<value>com/jbit/cinema/entity/Subject.hbm.xml</value>
			</list>
		</property>
	</bean>
	<!-- 配置Hibernate事务管理器 -->
	<bean id="txManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>
	<!-- 配置事务通知 -->
	<tx:advice id="txAdvice" transaction-manager="txManager">
		<tx:attributes>
			<!-- 对get/find/search/query/select开头的方法开启只读事务 -->
			<tx:method name="get*" read-only="true" />
			<tx:method name="find*" read-only="true" />
			<tx:method name="search*" read-only="true" />
			<tx:method name="query*" read-only="true" />
			<tx:method name="select*" read-only="true" />
			<tx:method name="add*" propagation="REQUIRED" />
			<tx:method name="save*" propagation="REQUIRED" />
			<tx:method name="update*" propagation="REQUIRED" />
			<tx:method name="modify*" propagation="REQUIRED" />
			<tx:method name="del*" propagation="REQUIRED" />
			<tx:method name="do*" propagation="REQUIRED" />
			<tx:method name="*" propagation="REQUIRED" read-only="true" />
		</tx:attributes>
	</tx:advice>
	<!--<aop:config>
		 配置切面 -->
	<!--
		<aop:pointcut expression="execution(*
		com.jbit.cinema.service.impl.*.*(..))" id="serviceMethod"/>
	--><!-- 织入 -->
	<!--
		<aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod"/>
		</aop:config>
	-->

	<!-- 配置Dao -->
	<bean id="TimetableDAO" class="com.jbit.cinema.dao.impl.TimetableDaoImpl">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="MovieDAO" class="com.jbit.cinema.dao.impl.MovieDaoImpl">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="PwdprotectDAO" class="com.jbit.cinema.dao.impl.PwdprotectDaoImpl">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="OrdersDAO" class="com.jbit.cinema.dao.impl.OrdersDaoImpl">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="UsersDAO" class="com.jbit.cinema.dao.impl.UsersDaoImpl">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="ActivityDAO" class="com.jbit.cinema.dao.impl.ActivityDaoImpl">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>
	<bean id="SeatDAO" class="com.jbit.cinema.dao.impl.SeatDaoImpl">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="SalleDAO" class="com.jbit.cinema.dao.impl.SalleDaoImpl">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="OnlinecinemaDAO" class="com.jbit.cinema.dao.impl.OnlinecinemaDAOImpl">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean class="com.jbit.cinema.dao.impl.BoardDaoImpl" id="BoardDAO">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean class="com.jbit.cinema.dao.impl.ReplyDaoImpl" id="ReplyDAO">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean class="com.jbit.cinema.dao.impl.SubjectDaoImpl" id="SubjectDAO">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>

	<!-- 配置service -->
	<bean id="UsersService" class="com.jbit.cinema.service.impl.UsersServiceImpl">
		<property name="usersDao" ref="UsersDAO" />
		<property name="pwdprotectService" ref="PwdprotectService" />
	</bean>
	<bean id="MovieService" class="com.jbit.cinema.service.impl.MovieServiceImpl">
		<property name="md" ref="MovieDAO" />
	</bean>
	<bean id="ActivityService" class="com.jbit.cinema.service.impl.ActivityServiceImpl">
		<property name="ad" ref="ActivityDAO" />
	</bean>
	<bean id="TimetableService" class="com.jbit.cinema.service.impl.TimetableServiceImpl">
		<property name="td" ref="TimetableDAO" />
	</bean>

	<bean id="PwdprotectService" class="com.jbit.cinema.service.impl.PwdprotectServiceImpl">
		<property name="pwdprotectDao" ref="PwdprotectDAO" />
	</bean>
	<bean id="OnMovieService" class="com.jbit.cinema.service.impl.OnMovieServiceImpl">
		<property name="onMovie" ref="OnlinecinemaDAO" />
	</bean>
	<bean name="SeatService" class="com.jbit.cinema.service.impl.SeatServiceImpl">
		<property name="sd" ref="SeatDAO" />
	</bean>
	<bean name="OrdersService" class="com.jbit.cinema.service.impl.OrdersServiceImpl">
		<property name="od" ref="OrdersDAO" />
	</bean>
	<bean class="com.jbit.cinema.service.impl.BoardServiceImpl" id="BoardService">
		<property name="boardDao" ref="BoardDAO" />
	</bean>
	<bean class="com.jbit.cinema.service.impl.SubjectServiceImpl" id="SubjectService">
		<property name="subjectDao" ref="SubjectDAO" />
		<property name="replyDao" ref="ReplyDAO" />
	</bean>
	<bean class="com.jbit.cinema.service.impl.ReplyServiceImpl" id="ReplyService">
		<property name="replyDao" ref="ReplyDAO" />
	</bean>

	<!-- 配置Action -->
	<bean id="MovieAction" class="com.jbit.cinema.action.MovieAction">
		<property name="ms" ref="MovieService" />
	</bean>

	<bean id="ActivityAction" class="com.jbit.cinema.action.ActivityAction">
		<property name="as" ref="ActivityService" />
	</bean>

	<bean id="TimetableAction" class="com.jbit.cinema.action.TimetableAction">
		<property name="ms" ref="MovieService" />
		<property name="ts" ref="TimetableService" />
	</bean>
	<bean id="onCinemaAction" class="com.jbit.cinema.action.OnMovieAction">
		<property name="onMovieBiz" ref="OnMovieService" />
	</bean>
	<bean name="SeatAction" class="com.jbit.cinema.action.SeatAction">
		<property name="ss" ref="SeatService" />
	</bean>
	<bean name="OrdersAction" class="com.jbit.cinema.action.OrdersAction">
		<property name="os" ref="OrdersService" />
		<property name="ss" ref="SeatService"/>
	</bean>
	<bean class="com.jbit.cinema.action.UsersAction" id="UsersAction">
		<property name="usersService" ref="UsersService" />
		<property name="pwdprotectService" ref="PwdprotectService" />
	</bean>
	<bean class="com.jbit.cinema.action.BoardAction" id="BoardAction">
		<property name="boardService" ref="BoardService" />
	</bean>
	<bean class="com.jbit.cinema.action.SubjectAction" id="SubjectAction">
		<property name="subjectService" ref="SubjectService" />
		<property name="replyService" ref="ReplyService" />
	</bean>
	<bean class="com.jbit.cinema.action.ReplyAction" id="ReplyAction">
		<property name="replyService" ref="ReplyService" />
	</bean>

</beans>

 

二、hibernate映射文件

 

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- 
    Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
    <class name="com.jbit.cinema.entity.Orders" table="ORDERS" schema="CINEMASYSTEM">
        <id name="id" type="java.lang.Integer">
            <column name="ID" precision="10" scale="0" />
            <generator class="sequence">
               <param name="sequence">SEQ_ORDERS_ID</param>
            </generator>
        </id>
        <property name="UId" type="java.lang.Integer">
            <column name="U_ID" precision="6" scale="0" not-null="true" />
        </property>
        <property name="moviename" type="java.lang.String">
            <column name="MOVIENAME" length="50" not-null="true" />
        </property>
        <property name="pid" type="java.lang.Integer">
            <column name="PID" precision="6" scale="0" not-null="true" />
        </property>
        <property name="count" type="java.lang.Integer">
            <column name="COUNT" precision="6" scale="0" not-null="true" />
        </property>
        <property name="payWay" type="java.lang.String">
            <column name="PAY_WAY" length="20" not-null="true" />
        </property>
        <property name="placeNumber" type="java.lang.String">
            <column name="PLACE_NUMBER" length="200" not-null="true" />
        </property>
        <property name="totalMoney" type="java.lang.Integer">
            <column name="TOTAL_MONEY" precision="6" scale="0" not-null="true" />
        </property>
        <property name="reserveIme" type="java.util.Date">
            <column name="RESERVE_IME" length="7" not-null="true" />
        </property>
    </class>
</hibernate-mapping>

 

三、struts2配置文件

 

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
	<constant name="struts.il8n.encoding" value="UTF-8" />
	<package name="json" namespace="/" extends="json-default">
		<action name="CheckUserName" class="UsersAction" method="checkUserName">
			<result type="json">
				<param name="root">result</param>
			</result>
		</action>
	</package>
	<package name="default" namespace="/" extends="struts-default">
		<!-- 定义拦截器组 -->
		<interceptors>
			<!-- 定义权限拦截的应用类 -->
			<interceptor name="myAuthor"
				class="com.jbit.cinema.interceptor.AuthorInterceptor">
				<!-- 定义需要拦截的方法 -->
				<param name="includeMethods">addR,addS,updatePwd,updateProblem,loadProtect,getOne,book_ticket</param>
			</interceptor>
			<!-- 定义拦截器栈 -->
			
			<interceptor-stack name="myStack">
				<interceptor-ref name="defaultStack" />
				<interceptor-ref name="myAuthor" />
			</interceptor-stack>
		</interceptors>
		<!-- 定义默认拦截器栈 -->
		<default-interceptor-ref name="myStack" />
		<!-- 定义全局结果 -->
		
		<global-results>
			<result name="login">member_center.jsp</result>
		</global-results>
		<!--配置用户Action以及method -->
		
		<action name="*User" method="{1}" class="UsersAction">
			<result name="success" type="redirect">${nextDispose}</result>
			<result name="input" type="redirect">${nextDispose}</result>
		</action>
		<!-- 配置版块Action以及method -->
		
		<action name="*Board" method="{1}" class="BoardAction">
			<result name="success" type="redirect">${nextDispose}</result>
			<result name="input" type="redirect">${nextDispose}</result>
		</action>
		<!-- 配置主题Action以及method -->
		
		<action name="*Subject" method="{1}" class="SubjectAction">
			<result name="success" type="redirectAction">${nextDispose}</result>
			<result name="input" type="redirect">${nextDispose}</result>
		</action>
		<!-- 配置回复Action以及method -->
		
		<action name="*Reply" method="{1}" class="ReplyAction">
			<result name="success" type="redirectAction">${nextDispose}</result>
			<result name="input" type="redirect">${nextDispose}</result>
		</action>
		<action name="*movie" class="MovieAction" method="{1}">
			<result name="save" type="redirectAction">getmovie</result>
			<result name="success">index.jsp</result>
			<result name="fenye">${nextPage}</result>
			<result name="findMovie">movieinfo.jsp</result>
			<result name="error">error.jsp</result>
		</action>
		<action name="*activity" class="ActivityAction" method="{1}">
			<result name="success" type="redirectAction">getmovie</result>
			<result name="findAll">filmMovement.jsp</result>
			<result name="findOne">ActivtiyInfo.jsp</result>
			<result name="type">activity.jsp</result>
			<result name="error">error.jsp</result>
		</action>
		<action name="*timetable" class="TimetableAction" method="{1}">
			<result name="success" type="redirectAction">getmovie</result>
			<result name="findAll">${nextPage}</result>
			<result name="getOne">ticketing_step2.jsp</result>
			<result name="error">error.jsp</result>
		</action>
		<action name="*onMovie" class="onCinemaAction" method="{1}">
			<result name="success">${nextPage}</result>
		</action>
		<action name="*Seat" class="SeatAction" method="{1}">
			<result name="findAll">ticketing_step4.jsp</result>
		</action>
		<action name="*Orders" class="OrdersAction" method="{1}">
			<result name="save" type="redirect">ticketing_step5.jsp</result>
		</action>
	</package>
</struts>    

 

分享到:
评论

相关推荐

    ssh集成 ssh集成

    SSH集成通常指的是将SSH功能与其他系统或工具整合,以实现更高效、更安全的远程管理和服务交互。在IT领域,SSH集成尤其常见于服务器管理、自动化任务执行、版本控制系统(如Git)以及持续集成/持续部署(CI/CD)流程...

    ssh集成jar包整合

    在"ssh集成类库整合"的压缩包中,可能包含了以下关键jar文件: 1. Spring框架的jar文件:如spring-context、spring-beans、spring-web等,这些文件提供了Spring的核心功能。 2. Struts框架的jar文件:如struts2-...

    SSH框架整合教程

    SSH框架整合教程是Java开发领域中的一个重要主题,它涉及到三个核心的开源框架:Struts、Spring和Hibernate。这些框架在企业级应用开发中扮演着关键角色,分别负责表现层、业务逻辑层和数据持久化层的管理。 Struts...

    详解SSH框架和Redis的整合

    SSH框架指的是Struts、Spring和Hibernate三个开源...同时,这种整合也为日后的扩展提供了便利,例如,可以进一步集成Redis的发布/订阅功能,实现消息通知,或者利用Redis的地理空间索引功能进行地理位置相关的查询。

    ssh集成类库整合

    这个"ssh集成类库整合"的压缩包很可能是为了帮助开发者快速搭建基于SSH的项目环境而提供的资源集合。 1. **Spring框架**:Spring是Java企业级应用的核心框架,它提供了依赖注入(Dependency Injection,DI)和面向...

    SSH框架整合的jar包

    SSH框架,全称为Struts2、Spring和Hibernate的组合,是Java Web开发中常见的三大开源框架集成。它们分别负责表现层、业务层和服务层的管理,构建了一个完整的MVC(Model-View-Controller)架构。下面将详细介绍这三...

    SSH框架整合jar包

    SSH框架整合是Java Web开发中常见的一种技术栈组合,它由Spring、Struts2和Hibernate三个框架构成。这个"SSH框架整合jar包"是开发者为了方便项目构建,避免手动逐个添加和配置这三个框架所需的库文件而制作的集合。...

    SSH集成SSH集成

    5. **整合测试**:编写JUnit测试用例,验证SSH集成是否正常工作。 SSH集成的优势在于: - **松耦合**:通过依赖注入,降低了各组件间的耦合度。 - **模块化**:每个框架专注于自己的职责,使得代码结构清晰。 - **...

    ssh框架整合需要的 jar包

    SSH框架整合是Java Web开发中常见的一种技术栈组合,它由Spring、Struts2和Hibernate三个框架组成。这些框架分别负责应用的依赖注入(DI)、表现层管理和持久化层操作,为开发者提供了一套高效、灵活的解决方案。...

    SSH框架整合完整版

    在SSH整合中,Spring作为核心,协调其他两个框架,并可以处理数据访问、业务逻辑和服务层的集成。 其次,**Struts框架**是MVC(Model-View-Controller)设计模式的一种实现,主要关注于Web层的控制。它接收用户的...

    SSH整合jar包

    SSH整合jar包是一个集合了所有在Java开发中用于Spring、Struts和Hibernate(SSH)集成应用所需的库文件的压缩包。SSH是Java企业级开发中非常流行的一种框架组合,它能够帮助开发者快速构建高效、可维护的企业级Web...

    ssh整合所需所有架包

    使用这个整合包,开发者可以直接引入这些库,快速搭建一个SSH集成的开发环境,省去了单独下载和版本匹配的步骤,提高了开发效率。在实际项目中,还需要根据具体需求进行详细配置和编码,才能完成一个完整的SSH整合...

    SSH集成框架(源码)

    通过提供的"SSH集成.doc"文档,学生和开发者可以深入研究SSH框架的集成细节,了解各个组件的配置和使用方法,以及在实际项目中如何进行有效整合。文档可能涵盖了配置示例、常见问题解答、最佳实践等内容,对于提升...

    SSH整合实例(登陆)

    Struts Hibernate Spring SSH Java Web 集成 整合 框架 Struts Hibernate Spring SSH Java Web 集成 整合 框架 Struts Hibernate Spring SSH Java Web 集成 整合 框架

    SSH框架整合模版,非常详细实用

    SSH框架,全称为Spring、Struts2和Hibernate的集成,是Java Web开发中常见的三大开源框架的组合。这些框架各自负责应用的不同层面:Spring提供IoC(Inversion of Control)和AOP(Aspect-Oriented Programming)功能...

    activemq实战项目,同ssh框架整合(生产者+消费者)

    在本项目中,我们主要探讨的是如何将ActiveMQ与SSH(Spring、Struts、Hibernate)框架集成,构建一个完整的实际应用。ActiveMQ是Apache软件基金会的顶级项目,它是一款开源的消息中间件,用于处理应用程序之间的异步...

    ssh2整合步骤

    SSH2整合指的是在Java开发中将Spring、Struts2和Hibernate三个开源框架集成在一起,以构建高效、灵活的企业级Web应用程序。在这个过程中,Spring提供依赖注入和事务管理,Struts2负责视图和控制层,而Hibernate则...

    ssh框架 整合代码

    SSH框架整合是Java Web开发中常见的一种技术组合,它由Spring、Struts2和Hibernate三个开源框架构成。Spring提供依赖注入(DI)和面向切面编程(AOP),Struts2作为MVC框架负责控制层,而Hibernate则作为对象关系...

    SSHA【All】Conformity,SSHA整合,Spring,Hibernate,Struts

    SSHA整合是将上述三个框架集成在一起,形成一个强大的开发环境。整合过程主要包括以下几个步骤: 1. 配置Spring:定义Bean,设置依赖注入,配置事务管理。 2. 集成Struts:在Struts的Action类中注入Spring管理的Bean...

Global site tag (gtag.js) - Google Analytics