项目结构

各类配置文件

 <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="pojo">
<class name="Product" table="product_">
<id name="id" column="id">
<generator class="native">
</generator>
</id>
<property name="name" />
<property name="price" />
</class> </hibernate-mapping>

Product.hbm.xml

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd"> <struts>
<constant name="struts.i18n.encoding" value="UTF-8"></constant> <constant name="struts.objectFactory" value="spring"/> <package name="basicstruts" extends="struts-default"> <action name="listProduct" class="productActionBean" method="list">
<result name="listJsp">list.jsp</result>
</action> </package>
</struts>

struts.xml

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <bean name="productActionBean" class="action.ProductAction">
<property name="productService" ref="productServiceImpl" />
</bean> <bean name="productServiceImpl"
class="service.impl.ProductServiceImpl">
<property name="productDAO" ref="productDAOImpl" />
</bean>
<bean name="productDAOImpl" class="dao.impl.ProductDAOImpl">
<property name="sessionFactory" ref="sf" />
</bean> <bean name="sf"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="ds" />
<property name="mappingResources">
<list>
<value>pojo/Product.hbm.xml</value>
</list>
</property> <property name="schemaUpdate">
<value>true</value>
</property> <property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=true
hbm2ddl.auto=update
</value>
</property>
</bean> <bean name="ds"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8" />
<property name="username" value="root" />
<property name="password" value="admin" />
</bean>
</beans>

applicationContext.xml

 <web-app>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter> <filter-mapping>
<filter-name>struts2</filter-name>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<url-pattern>/*</url-pattern>
</filter-mapping> <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> </web-app>

web.xml

最新文章

  1. 学霸数据处理项目之数据处理网页以及后台以及C#代码部分开发者手册
  2. mono 开发
  3. offset求结构体成员的偏移量
  4. 键盘按钮keyCode大全,keyCode列表对照表
  5. Linux常用命令总结--分布式应用部署与监控
  6. C#事物执行数据
  7. mysql 错误解决
  8. Android-Socket传输 GPRS网络
  9. Android开发有用的站点
  10. javascript实现代码高亮
  11. 团队作业10——复审和事后分析(Beta版本)
  12. LeetCode之“树”:Symmetric Tree &amp;&amp; Same Tree
  13. log4cplus 简单记录
  14. Java实现多线程生产者消费者模型及优化方案
  15. Callable和Future、FutureTask的使用
  16. Appium 自带的定位工具 Inspector
  17. Writing a Reusable Custom Control in WPF
  18. 沧桑巨变中焕发青春活力-记极1s HC5661A 打怪升级之路
  19. Easy WordPress Updates: Store FTP Info in wp-config.php
  20. linux的pthread_self与gettid的返回值和开销的区别

热门文章

  1. OOM的起点到终点
  2. ELSE 技术周刊(2017.12.25期)
  3. JDK 配置环境变量
  4. 题目分享F 二代目
  5. Redis 6.0 新特性-多线程连环13问!
  6. 软件——IDEA中如何去掉警告虚线
  7. 仿站-获取网站的所有iconfont图标
  8. 【GISER&amp;&amp;规划】我这二三年
  9. 【HBase】快速了解上手rowKey的设计技巧
  10. node.js开发指南系列(1)partial is not defined