开发环境JBuilder2005.
applicationContext.xml置于目录/WEB-INF/applicationContext.xml下,源文件如下:
<?xml version= "1.0 " encoding= "UTF-8 "?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN " "http://www.springframework.org/dtd/spring-beans.dtd ">
<beans>
<bean id= "dataSource "
class= "org.apache.commons.dbcp.BasicDataSource ">
<property name= "driverClassName ">
<value> net.sourceforge.jtds.jdbc.Driver </value>
</property>
<property name= "url ">
<value> jdbc:jtds:sqlserver://10.1.8.101:1433;DatabaseName=swai_oa </value>
</property>
<property name= "username ">
<value> sa </value>
</property>
<property name= "password ">
<value> 123 </value>
</property>
</bean>
<bean id= "sessionFactory "
class= "org.springframework.orm.hibernate3.LocalSessionFactoryBean ">
<property name= "dataSource ">
<ref bean= "dataSource " />
</property>
<property name= "mappingResources ">
<list>
<value> com/test/User.hbm.xml </value>
</list>
</property>
<property name= "hibernateProperties ">
<props>
<prop key= "hibernate.dialect ">
net.sf.hibernate.dialect.SQLServerDialect
</prop>
<prop key= "hibernate.show_sql "> true </prop>
</props>
</property>
</bean>
<bean id= "userDAO " class= "com.test.daolmp.UserDAOlmp ">
<property name= "sessionFactory ">
<ref local= "sessionFactory "/>
</property>
</bean>
<bean id= "transactionManager " class= "org.springframework.orm.hibernate3.HibernateTransactionManager ">