sturts 1.23 +spring 2.5 + hibernate3.2 整合

发了几天时间学习了一下这三个框架 虽然对里面的东西具体还不是很熟但还是整合成功。。 蛮高兴的 也算是有点收获 ! 不过自己一个人自学感觉还是有点辛苦!! 但是还是很想走这条路。发展下去。 男生嘛,应该不怕挑战!加油给自己打打气。。
以下是我自己整合成功后的配置文件! 哈哈。 蛮简单的!!
struts-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">

<struts-config>
<data-sources />
<form-beans >
<form-bean name="userForm" type="com.good.struts.form.UserForm" />
</form-beans>

<global-exceptions />
<global-forwards />
<action-mappings >
<!-- type="org.springframework.web.struts.DelegatingActionProxy" -->
<action
attribute="userForm"
input="/false.jsp"
name="userForm"
path="/user"
scope="session"
type ="org.springframework.web.struts.DelegatingActionProxy"
/>
</action-mappings>

<message-resources parameter="com.good.struts.ApplicationResources" />

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
</plug-in>

</struts-config>


application.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="dao" class="com.good.dao.impl.userDAOImpl" lazy-init="default" autowire="default" dependency-check="default">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>

<bean name="/user" class="com.good.struts.action.UserAction" lazy-init="default" autowire="default" dependency-check="default">
<property name="dao">
<ref local="dao" />
</property>
</bean>

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>/WEB-INF/hibernate.cfg.xml</value>
</property>
</bean></beans>


hibernate.cfg.xml


<?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">

<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>

<session-factory>
<property name="connection.username">root</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/msdl
</property>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="myeclipse.connection.profile">mysql</property>
<property name="connection.password">123456</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="show_sql">true</property>
<property name="connection.autocommit">true</property>
<mapping resource="com/good/vo/Newuser.hbm.xml" />

</session-factory>

</hibernate-configuration>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值