小弟现在学的struts,想学习struts+hibernate,请有struts+hibernate的网上商城源码给小弟一个,小弟不胜感激拜谢各位高人

解决方案 »

  1.   

    在与数据库操作的时候,持久化对象,查询数据就是用hibernate了...
      

  2.   

    struts 和后台action 的数据交互,action 中调接口, hibernate 来操作数据持久化。
      

  3.   

    <?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="dialect">
    org.hibernate.dialect.MySQLDialect
    </property>
    <property name="connection.url">jdbc:mysql://10.10.101.25:3306/项目名?useUnicode=true&amp;characterEncoding=utf-8</property>
    <property name="connection.username">用户名</property>
    <property name="connection.password">密码</property>
    <property name="connection.driver_class">
    com.mysql.jdbc.Driver
    </property>
    <!--  
    <property name="hibernate.hbm2ddl.auto">update</property>
    -->
    这里就写映射文件路径。


    </session-factory>
    </hibernate-configuration>
      

  4.   

    可以发个Struts2+hibernate3.3的登录注册实例给你不懂可以加我QQ602718868
      

  5.   

    <?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="dialect">
    org.hibernate.dialect.MySQLDialect
    </property>
    <property name="connection.url">jdbc:mysql://10.10.101.25:3306/项目名?useUnicode=true&amp;www.cctv40.comcharacterEncoding=utf-8</property>
    <property name="connection.username">用户名</property>
    <property name="connection.password">密码</property>
    <property name="connection.driver_class">
    com.mysql.jdbc.Driver
    </property>
    <!--   
    <property name="hibernate.hbm2ddl.auto">update</property>
    -->不对么?、好像