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

来源:互联网 发布:nvsip监控软件下载 编辑:程序博客网 时间:2024/05/19 17:47

首先配置架包支持:

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:


导入支持文件:





添加实体类:







0 0
原创粉丝点击