spring3.2MVC与hibernate3整合配置文件
来源:互联网 发布:ubuntu cp命令 编辑:程序博客网 时间:2024/06/06 08:48
主要是三个配置文件web.xml、springMVC.xml、hibernate.cfg.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_2_5.xsd"id="WebApp_ID" version="2.5"><display-name>ManagementSys</display-name><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list><servlet><servlet-name>springMVC</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><init-param><param-name>contextConfigLocation</param-name><!-- 表示从类路径寻找配置文件,但是不知道为什么这里有个*号,去掉也是可以的 --><param-value>classpath:springMVC.xml</param-value></init-param><!-- 表示启动容器时初始化该servlet --><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>springMVC</servlet-name><!-- 拦截后缀.do的请求,这样不需要考虑静态资源被拦截的问题 --><url-pattern>*.do</url-pattern></servlet-mapping></web-app>
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"><!-- 该配置文件加载表现层所有bean,数据源、服务层、DAO层、事务的Bean在父容器中加载 --><!-- 自动扫描的包名,因为配置了自动扫描,就不需要配置控制器Bean了,否则启动会报错 --><context:component-scan base-package="com.shdc"></context:component-scan><!-- 默认的注解映射的支持 --><mvc:annotation-driven /><!-- 视图解析器 --><beanclass="org.springframework.web.servlet.view.InternalResourceViewResolver"><property name="viewClass"value="org.springframework.web.servlet.view.JstlView" /><property name="prefix" value="/WEB-INF/jsp/" /><property name="suffix" value=".jsp" /></bean><!-- 整合hibernate --><bean id="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><property name="configLocations"><value>classpath:hibernate.cfg.xml</value></property></bean></beans>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration><session-factory><!-- JDBC驱动程序 --><property name="connection.driver_class">com.mysql.jdbc.Driver</property><!-- JDBC URL --><property name="connection.url">jdbc:mysql://127.0.0.1:33306/test</property><!-- 数据库用户名 --><property name="connection.username">root</property><!-- 数据库密码 --><property name="connection.password">root</property><!--显示实际操作数据库时的SQL语句 --><property name="show_sql">true</property><!--SQL方言 --><property name="dialect">org.hibernate.dialect.MySQLDialect</property><!-- 自动更新数据库表结构 --><property name="hbm2ddl.auto">create</property></session-factory></hibernate-configuration>
- spring3.2MVC与hibernate3整合配置文件
- Spring3.0+Struts2.2+Hibernate3.6整合与常见问题
- springMVC3.2+spring3.2.1+hibernate3.2整合
- Struts2.2+Spring3.0+Hibernate3.6整合
- struts2 spring3 hibernate3整合
- Struts2+Spring3+Hibernate3整合
- Struts2+Hibernate3+Spring3 整合
- Struts2+Spring3+Hibernate3整合
- spring3 struts2 hibernate3整合
- SSH2(Struts2、Spring3与Hibernate3)的整合
- 第五章 Spring3.0 、Hibernate3.3与Struts2的整合
- struts2+spring3+hibernate3整合步骤
- struts2+hibernate3+spring3整合步骤
- Struts2-Spring3-Hibernate3整合开发
- Spring3.2.6整合Hibernate3.1.2
- 【Struts2+Spring3+Hibernate3】SSH框架整合实现CRUD_1.2
- 整合SSH步骤,版本:Strust2.3+Spring3.2+Hibernate3.6
- Struts2.0+Hibernate3.0+Spring3.2整合实例
- (已解)android引用jar包后报类未定义错误
- 如何让ubuntu12.04(64 bit)下面编译的程序能在10.04下成功运行
- asp.net 导出TXT笔记
- lucene 区分大小写问题和解决方案
- javascript Cookie的增、删、改 、查
- spring3.2MVC与hibernate3整合配置文件
- Project Euler 51 Prime digit replacements(枚举)
- 使用shell写cgi不能拷贝的问题
- C# TreeView递归显示整个系统盘符文件目录及文件
- 策略模式(Strategy)
- Why you should take your 20s seriously
- 关于Wubi安装增加容量以及移至真实分区的解决方法
- 浅析值类型与引用类型的内存分配[转载]
- [面试] 结构体占用空间的问题,内存对齐~! 真的懂了,cpu取加快速度,省空间来考虑。