SSH框架搭建
来源:互联网 发布:淘宝怎么找不到高仿表 编辑:程序博客网 时间:2024/06/05 08:06
struts.xml文件配置
<?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><!-- 声明spring处理struts --><constant name="struts-ObjectFactory" value="spring"/><!-- 配置文件 --><include file="users.xml"/><include file="email.xml"/><include file="leave.xml"/></struts>
web.xml文件配置
<?xml version="1.0" encoding="UTF-8"?><web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <display-name></display-name> <welcome-file-list> <welcome-file>login.jsp</welcome-file> </welcome-file-list> <!-- 加载spring配置文件 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:bean.xml</param-value> </context-param> <!-- 上下文监听器 --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- 中文过滤 --> <filter> <filter-name>CharacterEncodingFilter</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>CharacterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- 会话过滤 --> <filter> <filter-name>OpenSessionInViewFilter</filter-name> <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class> </filter> <filter-mapping> <filter-name>OpenSessionInViewFilter</filter-name> <url-pattern>*.do,*.action</url-pattern> </filter-mapping> <!-- 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></web-app>
spring.xml文件配置
<?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" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd "> <!-- 注解扫描 --> <context:component-scan base-package="com.hlx.csl.officeauto.util, com.hlx.csl.officeauto.action, com.hlx.csl.officeauto.dao.impl, com.hlx.csl.officeauto.biz.impl"/> <!-- 数据源 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="oracle.jdbc.OracleDriver"> </property> <property name="url" value="jdbc:oracle:thin:@localhost:1521:chen"> </property> <property name="username" value="ssh"></property> <property name="password" value="ssh"></property> </bean> <!-- 会话 --> <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.Oracle9Dialect </prop> <prop key="hibernate.hbm2ddl.auto">update</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> </props> </property> <!-- Hibernate映射文件 --> <property name="mappingResources"> <list> <value> com/hlx/csl/officeauto/entity/Users.hbm.xml </value> <value> com/hlx/csl/officeauto/entity/Email.hbm.xml </value> <value> com/hlx/csl/officeauto/entity/Leave.hbm.xml </value></list> </property> </bean> <!-- Hibernate --> <bean class="org.springframework.orm.hibernate4.HibernateTemplate" id="hibernateTemplate"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <!-- 会话管理 --> <bean class="org.springframework.orm.hibernate4.HibernateTransactionManager" id="transactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <!-- 事务通知 --> <tx:advice transaction-manager="transactionManager" id="txAdvice"> <tx:attributes> <tx:method name="*update*" propagation="REQUIRED"/> <tx:method name="*del*" propagation="REQUIRED"/> <tx:method name="*add*" propagation="REQUIRED"/> <tx:method name="*find*" propagation="SUPPORTS"/> <tx:method name="*look*" propagation="SUPPORTS"/> </tx:attributes> </tx:advice> <!-- 切面配置 --> <aop:config> <aop:pointcut expression="execution(* com.hlx.csl.officeauto.biz.impl.*.*(..))" id="cut"/> <aop:advisor advice-ref="txAdvice" pointcut-ref="cut"/> </aop:config> </beans>
阅读全文
0 0
- SSH框架搭建
- ssh框架搭建问题解决
- ssh框架搭建
- 快速搭建ssh框架
- SSH框架搭建流程
- SSH框架搭建
- 搭建ssh框架
- ssh 框架 搭建
- SSH框架搭建步骤
- 初学搭建SSH框架
- SSH框架搭建
- SSH框架搭建
- ssh框架搭建
- ssh框架搭建
- 手动搭建ssh框架
- ssh框架搭建
- SSH框架的搭建
- Myeclipse10 搭建SSH框架
- 新XListView连接网络请求数据
- matlab2c使用c++实现matlab函数系列教程-randint函数
- 除了alert,其他提示
- js中数组方法push()、shift()与pop()、unshift()的区别
- 安卓PagerAdapter的一个小漏洞
- SSH框架搭建
- C++文件读写操作(一) 逐字符读取文件
- Codeforces 853C Boredom
- CSS3图片翻转切换案例及其中重要属性解析 (赞)
- Spring初学小笔记1《2017-09-08》
- 【64位】centos7+jdk+mysql+tomcat配置
- hd--1114 存钱罐
- 1665:完美覆盖(4.5算法之动态规划)
- GYM 100488 Construct a Permutation(构造|想法)