springhibernate:使用Spring 2.5 和 Hibernate 3.2 开发MVC

使用Spring 2.5 和 Hibernate 3.2 开发MVC Web(基于annotation特性)

Spring 和 Hibernate 都支持annotation开发应用,无疑减少呢很多XML配置,使看起来更”干净”,下面我们以个简单例子来介绍说明:

开发环境:eclipse 3.2.2 + WTP + tomcat(推荐)

首先我们建个动态Web项目

修改WEB-INF/web.xml

<?xml version="1.0" encoding="UTF-8"?>

<web-app id="ascweb" version="2.4"

      xmlns="http://java.sun.com/xml/ns/j2ee"

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

      <display-name>ascweb</display-name>

 

      <!--  载入Spring配置文件 -->

      <context-param>

           <param-name>contextConfigLocation</param-name>

           <param-value>/WEB-INF/applicationContext.xml</param-value><!-- 自动载入spring配置 -->

      </context-param>

      <listener>

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

      </listener>


="xspace-totlerecord">11="xspace-totlepages">1/11="xspace-current">12345678910>>|
Tags:  springmvc配置 springmvc hibernate3.2 springhibernate

延伸阅读

最新评论

发表评论