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