日期:2014-05-18  浏览次数:20872 次

Struts+Hibernate+Spring 配置问题
新公司要求写一个Struts+Hibernate+Spring的例子,小弟搞了半天还是有问题,求助大家帮忙解决,问题如下:
环境:JDK1.5+Eclipse3.2+MyEclipse5.0+Tomcat5.5+SQL   2000
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= "userRegisterForm "   type= "test.struts.user.form.UserRegisterForm "   />

    </form-beans>

    <global-exceptions   />
    <global-forwards   />
    <action-mappings   >
        <action
            attribute= "userRegisterForm "
            input= "/userRegister.jsp "
            name= "userRegisterForm "
            path= "/userRegister "
            scope= "request "
            type= "org.springframework.web.struts.DelegatingActionProxy ">
            <forward   name= "success "   path= "/success.jsp "   />
            <forward   name= "fail "   path= "/fail.jsp "   />
        </action>

    </action-mappings>

    <message-resources   parameter= "test.struts.ApplicationResources "   />
    <plug-in   className= "org.springframework.web.struts.ContextLoaderPlugIn ">
    <set-property   property= "contextConfigLocation "   value= "/WEB-INF/classes/applicationContext.xml "/>
    </plug-in>
</struts-config>

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> com.microsoft.jdbc.sqlserver.SQLServerDriver </value>
</property>
<property   name= "url ">
<value> jdbc:microsoft:sqlserver://localhost:1433 </value>
</property>
<property   name= "username ">
<value> test </value>
</property>
<property   name= "password ">
<value> test </value>
</property>
</bean>
<bean   id= "sessionFactory "
class= "org.springframework.orm.hibernate3.LocalSessionFactoryBean ">
<property   name= "configLocation ">
<