`
qing393260529
  • 浏览: 46480 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Spring2.5+Struts2.18+Hibernate3.2 集成开发

阅读更多

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:aop="http://www.springframework.org/schema/aop"
      xmlns:tx="http://www.springframework.org/schema/tx"
      xmlns:context="http://www.springframework.org/schema/context"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"
           >
    <context:annotation-config/> 
    <!-- 使用annotation 自动注册bean,并保证@Required,@Autowired的属性被注入 -->
 <context:component-scan base-package="com.ssh" />
          
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
  <property name="driverClass">
   <value>com.mysql.jdbc.Driver</value>
  </property>
  <property name="jdbcUrl">
    <value>jdbc:mysql://127.0.0.1/test</value>
  </property>
  <property name="user">
   <value>root</value>
  </property>
  <property name="minPoolSize">
            <value>5</value>
        </property>
        <property name="maxPoolSize">
            <value>60</value>
        </property>
        <property name="initialPoolSize">
            <value>60</value>
        </property>
        <property name="maxIdleTime">
            <value>60</value>
        </property>
 </bean>
 
 <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
  <property name="dataSource" ref="dataSource"/>
  <property name="annotatedClasses">
   <list>
    <value>com.ssh.entity.User</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="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
         <property name="sessionFactory" ref="sessionFactory" />
   </bean>

   <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
   <property name="sessionFactory" ref="sessionFactory" />
   </bean>
  
   <tx:annotation-driven proxy-target-class="true" transaction-manager="transactionManager"/>

</beans>

 

struts 配置文件 信息:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
    "http://struts.apache.org/dtds/struts-2.1.7.dtd">
 <struts>
    <package name="struts" extends="struts-default">
        <action name="user" class="com.ssh.action.UserAction" method="addUser">
            <result>/success.jsp</result>
        </action>
    </package>
 </struts>

 

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>classpath:applicationContext.xml</param-value>
 </context-param>

 <listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>

   
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
     </filter>
    <filter-mapping>
         <filter-name>struts2</filter-name>
         <url-pattern>/*</url-pattern>
    </filter-mapping>

</web-app> 

分享到:
评论

相关推荐

    jqueryvalidator+spring3.0+struts2.18+hibernate3(修正版)

    jqueryvalidator+spring3.0+struts2.18+hibernate3(修正版)上次的程序有错误。是以前调试时候的。这次保证能够运行的起。本程序受http://www.gbsou.com/版主的巨大帮助深表感激。

    jqueryvalidate(猫冬)+spring3.0+struts2.18+hibernate3整合资源包

    该资源包是一个集成开发环境下的项目模板,主要涵盖了jQuery Validate、Spring 3.0、Struts 2.18和Hibernate 3这四个关键组件,它们是Java Web开发中的常用框架和技术。以下将分别对这些技术进行详细阐述。 **...

    基于Struts2.18+Spring2.5+Hibernater3.3+Annotation注解开发的电子商务网站demo

    Struts2.18、Spring2.5和Hibernate3.3是Java开发中经典的开源框架组合,被广泛用于构建企业级的电子商务网站。这个“基于Struts2.18+Spring2.5+Hibernate3.3+Annotation注解开发的电子商务网站demo”是一个很好的...

    整合struts2.18+spring3.0.2+hibernate3.5.1

    整合struts2.18+spring3.0.2+hibernate3.5.1,全部都是目前最新版本。手动添加的jar包,没有任何冗余。数据库是mysql5.0,有一张表“Test”,里面有两个字段“testid”、“testvalue”。

    Struts2.18+Spring2.56+Hibernate3+Extjs+JSON实现登陆修改密码等

    Struts2.18+Spring2.56+Hibernate3+Extjs+JSON是一个经典的Java Web开发技术组合,常用于构建高效、可扩展的企业级应用。这个项目涉及到的知识点广泛,涵盖前端、后端以及数据持久化等多个层面。以下是这些技术在...

    compass-2.2.0+hibernate-3.2+struts-2.1.8.1+spring-framework-2.5.4

    标题 "compass-2.2.0+hibernate-3.2+struts-2.1.8.1+spring-framework-2.5.4" 指的是一个集成开发环境,它结合了四个关键的技术组件:Compass、Hibernate、Struts 2 和 Spring Framework,这些都是Java Web开发中的...

    struts2+hibernate+annotation+spring整合的jar包

    这个压缩包包含了这三个框架的特定版本:Struts2.18、Hibernate3.3.2和Spring2.5.6,以及可能的配置文件和依赖库。这些框架的结合可以极大地提高Java Web应用的开发效率,提供模型-视图-控制器(MVC)架构、对象关系...

    struts2hibernate3.3.2+Spring2.5.5整合所有jar包

    Struts2、Hibernate3.3.2和Spring2.5.5是三个经典的Java开源框架,它们在企业级Web开发中被广泛使用。这组整合的jar包是为了解决这三个框架之间的集成问题,以便更好地管理和协调应用的MVC(模型-视图-控制器)架构...

    SSH配置好的代码模板+完整jar包

    SSH是Java Web开发中的一个流行框架组合,由Struts2、Hibernate和Spring组成。这个"SSH配置好的代码模板+完整jar包"提供了基于这些技术的基础结构,方便开发者快速搭建项目并进行学习或实际开发。 **Struts2** 是一...

    SSH整合实例

    这个实例是基于Struts2版本2.18、Hibernate版本3.3和Spring版本3.0的集成应用。以下是这些技术的详细介绍以及它们在整合中的作用。 **Struts2** 是一个用于构建企业级Web应用程序的开源MVC框架,它继承了Struts1的...

    java常用jar包

    java中常用的各种jar包都有,像ajax&jQuery,dom4j,hibernate_lib,JDBC_JAR,js,json_JAR,spring,struts2.18_core_JAR,XML_JSR都有,

    Spring攻略(第二版 中文高清版).part1

    6.3 将Spring与Struts 1.x集成 220 6.3.1 问题 220 6.3.2 解决方案 220 6.3.3 工作原理 220 6.4 将Spring与JSF集成 226 6.4.1 问题 226 6.4.2 解决方案 226 6.4.3 工作原理 227 6.5 将Spring与DWR...

    ssh2所需包

    Struts2.18是该框架的一个版本,可能包含了一些新的特性和性能优化,比如增强的类型转换、更好的异常处理和更多的插件支持。 其次,**Spring2.5.5** 是Spring框架的一个旧版本。Spring是一个全面的后端开发框架,...

    Spring攻略(第二版 中文高清版).part2

    6.3 将Spring与Struts 1.x集成 220 6.3.1 问题 220 6.3.2 解决方案 220 6.3.3 工作原理 220 6.4 将Spring与JSF集成 226 6.4.1 问题 226 6.4.2 解决方案 226 6.4.3 工作原理 227 6.5 将Spring与DWR...

    2011 广州 面试笔试题:.doc

    6. 三大框架Struts、Spring和Hibernate通常使用的版本分别是Struts2.18、Hibernate3.64和Spring2.53,但现代应用中可能使用更高版本或自定义封装。 7. Struts负责Web层交互,Hibernate处理数据层,Spring提供IOC和...

    stucts2描述

    - `struts-plugin.xml`:用于整合其他技术,如Spring、Hibernate等,提供额外的Result类型和拦截器。 3. **基本配置**: - `package`元素中的`namespace`属性用于限定Action请求的命名空间。 - `param`元素用于...

Global site tag (gtag.js) - Google Analytics