[原]Java web学习系列之 Java web开发中的SSH整合(Struts、Spring、Hibernate)(上)

首先配置架包支持:

Struts架包支持:

图片

得到struts-config.xml文件:

<struts-config>
  <form-beans />
  <global-exceptions />
  <global-forwards />
  <action-mappings />
  <message-resources parameter="org.clarck.struts.ApplicationResources" />
</struts-config>

接着添加Hibernate架包支持:

图片

图片

图片

图片

配置sessionFactory文件:

<hibernate-configuration>

    <session-factory>
        <property name="connection.username">sa</property>
        <property name="connection.url">jdbc:sqlserver://localhost:1433;databaseName=GOODS</property>
        <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
        <property name="myeclipse.connection.profile">sal</property>
        <property name="connection.password">sasa</property>
        <property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
    </session-factory>

</hibernate-configuration>

添加Spring架包支持:

图片

图片

图片

注入sessionFactory:图片

导入支持文件:

图片

图片

图片

图片

添加实体类:

 图片

 图片

图片

笔记记于:2010-9-1 12:33

原文地址:https://www.cnblogs.com/tanlon/p/2371430.html