java ssh环境搭建
来源:互联网 发布:linux测试dns解析命令 编辑:程序博客网 时间:2024/05/22 08:59
1.导入struts2+spring+hibernate包
2.配置web.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>JMWdistribution</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!--配置spring的用于初始化容器对象的监听器 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext*.xml</param-value>
</context-param>
<!-- 配置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>
3.配置applicationContext.xml文件(spring)
<!-- 自动扫描与装配 -->
<context:component-scan base-package="com.zpf.oa"/>
<!-- 导入外部的properties文件 -->
<context:property-placeholder location="classpath:jdbc.properties"/>
<!-- 配置sessionFactory -->
-<bean class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" id="sessionFactory">
<!-- 指定hibernate的配置文件位置 -->
<property value="classpath:hibernate.cfg.xml" name="configLocation"/>
<!-- 配置c3p0数据库连接池 -->
-<property name="dataSource">
-<bean class="com.mchange.v2.c3p0.ComboPooledDataSource">
<!-- 数据库连接信息 -->
<property value="${jdbcUrl}" name="jdbcUrl"/>
<property value="${driverClass}" name="driverClass"/>
<property value="${user}" name="user"/>
<property value="${password}" name="password"/>
<!-- *************其它配置********************* -->
<!--初始化时获取三个连接,取值应在minPoolSize与maxPoolSize之间。Default: 3 -->
<property value="3" name="initialPoolSize"/>
<!--连接池中保留的最小连接数。Default: 3 -->
<property value="3" name="minPoolSize"/>
<!--连接池中保留的最大连接数。Default: 15 -->
<property value="5" name="maxPoolSize"/>
<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
<property value="3" name="acquireIncrement"/>
<!-- 控制数据源内加载的PreparedStatements数量。如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0 -->
<property value="8" name="maxStatements"/>
<!--maxStatementsPerConnection定义了连接池内单个连接所拥有的最大缓存statements数。Default: 0 -->
<property value="5" name="maxStatementsPerConnection"/>
<!--最大空闲时间,1800秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
<property value="1800" name="maxIdleTime"/>
</bean>
</property>
</bean>
<!-- 配置声明式事务管理(采用注解的方式) -->
-<bean class="org.springframework.orm.hibernate3.HibernateTransactionManager" id="txManager">
<!-- 引用配置好的sessionFactory对象; -->
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- 注解驱动 ; 对应以上id -->
<tx:annotation-driven transaction-manager="txManager"/>
5.配置hibernate
-<session-factory>
<!-- 1.数据库连接信息 -->
<property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<!-- 2.其它设置 -->
<property name="show_sql">true</property>
<!-- 自动建表 -->
<property name="hbm2ddl.auto">update</property>
<!-- 3.导入映射文件 -->
<mapping resource="com/zpf/oa/domain/User.hbm.xml"/>
</session-factory>
- java ssh环境搭建
- SSH环境开发搭建
- SSH开发环境搭建
- ssh环境搭建
- SSH环境的搭建
- SSH环境搭建
- SSH环境搭建
- 搭建SSH开发环境
- ssh搭建开发环境
- SSH搭建环境
- SSH环境搭建
- SSH环境搭建
- ssh环境搭建
- SSH环境搭建
- SSH环境搭建
- 搭建ssh(Struts2)环境
- SSH之环境搭建
- SSH环境搭建
- HDU - 4961 Boring Sum
- The Ubuntu Install By USB
- QDrag简介
- InsertionSort
- ubuntu kugou音乐桌面版
- java ssh环境搭建
- java学习之嵌套循环
- 说一下你眼中的Android的优点和不足之处(面试华为的人有被问过)!!!
- 跨终端实践-天猫试戴的解决方案
- Oracle之Oradim工具
- 面向切面编程(AOP)的理解
- 【搞搞算法】Matlab遗传算法工具箱gatbx小试
- 关于linux挂载window下共享文件
- 万年历实现源代码