zoukankan      html  css  js  c++  java
  • SSH整合简述一

    1.web.xml中配置

    struts2过滤器
    
    <filter>
    <filter-name>struts2</filter-name>
    <filter-class>
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    </filter-class>
    </filter>
    <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
    <filter-mapping>
    增加spring上下文配置
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
    <context-param>
    增加监听器
    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListener
    </listerner-class>
    </listener>

    2.applicationContext.xml中配置

    applicationContext.xml中数据源配置 可以换成其它的数据源
    
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    属性驱动
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
    连接URL
    <property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl"/>
    用户名
    <property name="username" value="accp"/>
    密码
    <property name="password" value="accp"/>
    </bean>
    配置sessionFactory
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    关联数据源
    <property name="dataSource" ref="dataSource"/>
    配置hibernate的属性
    <property name="hibernateProperties">
    <props>
    连接数据库的方言这时视不同的数据和版本不同而定
    <prop key="hibernate.dialect">
    org.hibernate.dialect.Oracle9Dialect
    </prop>
    </props>
    </property>
    映射文件配置
    <property name="mappingResources">
    <list>
    <value>实现类的hibernate配置文件路径/类名.hbm.cfg</value>
    <value></value>
    </list>
    </property>
    </bean>

    3.struts.xml中配置

    在applicationContext.xml中配置struts的action后
    在struts.xml中action的class要写applicationContext.xml中配置struts的action的id

    以上手打可能有错,按需求配置

  • 相关阅读:
    intel dpdk在ubuntu12.04中測试testpmd、helloworld程序
    经常使用的MySQL语句整理
    韩国IT业是怎么走向国际我们须要学习什么
    【QT】C++ GUI Qt4 学习笔记3
    【编程之美】2.18 数组分割
    【编程之美】2.8 找符合条件的整数
    【QT】C++ GUI Qt4 学习笔记2
    【QT】C++ GUI Qt4 学习笔记1
    【编程之美】2.7求最大公约数
    【编程之美】2.6 精确表达浮点数
  • 原文地址:https://www.cnblogs.com/liunanjava/p/4416034.html
Copyright © 2011-2022 走看看