首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

struts整合spring 哪里出错了解决办法

2012-02-24 
struts整合spring哪里出错了小弟整合struts+hibernate+Spring不知道哪里错了,望大家指点一二?xmlversion

struts整合spring 哪里出错了
小弟整合struts   +hibernate   +   Spring  
不知道哪里错了,望大家指点一二  
<?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= "org.thj.shopping.struts.form.TUserForm ">
    </form-bean>
  </form-beans>
  <global-exceptions   />
  <global-forwards>
    <forward   name= "sucess "   path= "sucess.jsp "> </forward>
    <forward   name= "fail "   path= "fail.jsp "> </forward>
  </global-forwards>

  <action-mappings>
    <action   path= "/user "
      type= "org.springframework.web.struts.DelegatingActionProxy "
      input= "/test.jsp "   validate= "true "   name= "userForm "   />
  </action-mappings>

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

  <plug-in   className= "org.apache.struts.validator.ValidatorPlugIn ">
    <set-property   property= "pathnames "
      value= "/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml "   />
  </plug-in>
  <plug-in
    className= "org.springframework.web.struts.ContextLoaderPlugIn ">
    <set-property   property= "contextConfigLocation "
      value= "/WEB-INF/beans.xml "   />
  </plug-in>
 
 

 
 
</struts-config>


<?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.mysql.jdbc.Driver </value>
    </property>
    <property   name= "url ">
      <value> jdbc:mysql://localhost:3306/shop </value>
    </property>
    <property   name= "username ">
      <value> root </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= "hibernateProperties ">
      <props>
        <prop   key= "hibernate.dialect ">
          org.hibernate.dialect.MySQLDialect
        </prop>
      </props>
    </property>
    <property   name= "mappingResources ">
      <list>
        <value> org/thj/shopping/vo/TComment.hbm.xml </value>
        <value> org/thj/shopping/vo/Product.hbm.xml </value>
        <value> org/thj/shopping/vo/VProduct.hbm.xml </value>
        <value> org/thj/shopping/vo/TUser.hbm.xml </value>
        <value> org/thj/shopping/vo/ProductType2.hbm.xml </value>
        <value> org/thj/shopping/vo/TOrder.hbm.xml </value>
        <value> org/thj/shopping/vo/Shopping.hbm.xml </value>
        <value> org/thj/shopping/vo/ProductType.hbm.xml </value>
        <value> org/thj/shopping/vo/VShopping.hbm.xml </value>
        <value> org/thj/shopping/vo/VOrder.hbm.xml </value>
      </list>
    </property>
  </bean>
  <bean   id= "TCommentDAO "   class= "org.thj.shopping.vo.TCommentDAO ">
    <property   name= "sessionFactory ">
      <ref   bean= "sessionFactory "   />
    </property>
  </bean>
  <bean   id= "ProductDAO "   class= "org.thj.shopping.vo.ProductDAO ">
    <property   name= "sessionFactory ">
      <ref   bean= "sessionFactory "   />
    </property>
  </bean>
  <bean   id= "VProductDAO "   class= "org.thj.shopping.vo.VProductDAO ">
    <property   name= "sessionFactory ">
      <ref   bean= "sessionFactory "   />
    </property>
  </bean>
  <bean   id= "TUserDAO "   class= "org.thj.shopping.vo.TUserDAO ">
    <property   name= "sessionFactory ">
      <ref   bean= "sessionFactory "   />
    </property>
  </bean>
  <bean   id= "ProductType2DAO "
    class= "org.thj.shopping.vo.ProductType2DAO ">
    <property   name= "sessionFactory ">
      <ref   bean= "sessionFactory "   />
    </property>
  </bean>
  <bean   id= "TOrderDAO "   class= "org.thj.shopping.vo.TOrderDAO ">
    <property   name= "sessionFactory ">
      <ref   bean= "sessionFactory "   />


    </property>
  </bean>
  <bean   id= "ShoppingDAO "   class= "org.thj.shopping.vo.ShoppingDAO ">
    <property   name= "sessionFactory ">
      <ref   bean= "sessionFactory "   />
    </property>
  </bean>
  <bean   id= "ProductTypeDAO "   class= "org.thj.shopping.vo.ProductTypeDAO ">
    <property   name= "sessionFactory ">
      <ref   bean= "sessionFactory "   />
    </property>
  </bean>
  <bean   id= "VShoppingDAO "   class= "org.thj.shopping.vo.VShoppingDAO ">
    <property   name= "sessionFactory ">
      <ref   bean= "sessionFactory "   />
    </property>
  </bean>
  <bean   id= "VOrderDAO "   class= "org.thj.shopping.vo.VOrderDAO ">
    <property   name= "sessionFactory ">
      <ref   bean= "sessionFactory "   />
    </property>
  </bean>
  <bean   name= "/user "
    class= "org.thj.shopping.struts.action.UserAction ">
    <property   name= "TUserDAO ">
      <ref   bean= "TUserDAO "   />
    </property>
  </bean>
</beans>


[解决办法]
LZ您能贴出报错信息吗???这怎么看 帮您检查拼写错误?
[解决办法]
我也发现这样的问题,也想知道为什么?
[解决办法]
交流QQ群:32624506
[解决办法]
很可能是Hibernate映射文件有问题!
[解决办法]
你可以先实下不整合,看看有没有错。
[解决办法]
这个 问题是:
要删除2个包。
一个是:hibernat-an.....什么的。忘记了。
一个是:arm-2.2.3 好像是。删除这2个。

热点排行