开发流程:

1)引jar包,可以在配置工程中设置用户libarary,然后直接引入。如果在web-inf/lib没有用户导入的lib文件,可以参考问题0的解决方案

需要的是struts_core,spring_core,struts_spring_web

//struts_core
Struts2..32core\commons-fileupload-1.3..jar
Struts2..32core\commons-io-2.2.jar
Struts2..32core\commons-lang3-3.2.jar
Struts2..32core\freemarker-2.3..jar
Struts2..32core\javassist-3.11..GA.jar
Struts2..32core\ognl-3.0..jar
Struts2..32core\struts2-core-2.3..jar
Struts2..32core\xwork-core-2.3..jar
//spring_core
spring3..9core\commons-logging-1.2.jar
spring3..9core\spring-beans-3.2..RELEASE.jar
spring3..9core\spring-context-3.2..RELEASE.jar
spring3..9core\spring-core-3.2..RELEASE.jar
spring3..9core\spring-expression-3.2..RELEASE.jar
//struts_spring_web
struts-spring-web\struts2-spring-plugin-2.3..jar
struts-spring-web\spring-web-3.2..RELEASE.jar
struts-spring-web\spring-webmvc-3.2..RELEASE.jar

2)开发entity/dao/service/action

3)配置Struts2

web.xml文件配置struts2

<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>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- struts.xml文件    -->
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
"http://struts.apache.org/dtds/struts-2.1.dtd"> <struts>
<package name="Userpkg" extends="struts-default" >
<action name="save" class="userAction" method="saveUser">
<result name="success">/index.jsp</result>
</action>
</package>
</struts>

4)配置bean-dao.xml/bean-service.xml/bean-action.xml文件

 <!-- 所有DAO类的配置 -->
<bean id="userDao" class="com.huitong.Dao.impl.UserDao"></bean>
<?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:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd"> <!-- 所有Service类的配置 -->
<bean id="userService" class="com.huitong.service.impl.UserService">
<property name="userDao" ref="userDao"></property>
</bean> </beans>

bean-action.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:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd"> <!-- 所有Action类的配置 -->
<bean id="userAction" class="com.huitong.action.UserAction">
<property name="userService" ref="userService"></property>
</bean> </beans>

5)在web.xml文件中配置spring

<!--  配置spring -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/bean-*.xml</param-value>
</context-param> <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

最后可以测试了,应该是可以通过的

struts2.3.32,spring3.2.9进行整合,

出现问题0:MyEclipse 使用 User Library 不自动部署到 WEB-INF/lib

在项目上右键进入Properties,选择Deployment Assembly,再点击Add...,如下图所示:

2.然后在弹出的窗口中,选择Java Build Path Entries,点击Next,如下图所示:

3.选择你要你引入的UserLibrary,点击Finish即可

出现问题1:java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

解决办法:导包,spring-webmvc-3.2.9.RELEASE.jar

最新文章

  1. CreateCompatibleDC 与 CreateCompatibleBitmap 小小结
  2. Java Servlet(七):JavaWeb MVC 操作(jdk7+tomcat7+eclipse)
  3. twisted 学习笔记二:创建一个简单TCP客户端
  4. ASP.NET获取URL
  5. QT5.5与MYSQL5.6数据库连接的具体方法与实现
  6. of_alias_get_id 函数与设备树中aliases节点的关系【转】
  7. python 3编写贴吧图片下载软件(超简单)
  8. This Product is covered by one or more of the following......的问题
  9. Javascript根据id获取数组对象
  10. docker内存监控与压测
  11. Linux开机自动挂载存储的两种方式
  12. No address associated with hostname
  13. 【消息队列】kafka是如何保证高可用的
  14. gentoo rt-thread scons --menuconfig libs/lxdialog/util.o: undefined reference to symbol &#39;nodelay&#39;
  15. gcc 与 glibc 的关系 glibc版本查看
  16. c读入实型
  17. 问题:经典类的对象明明没有__class__属性,却可以调用。
  18. django 数据库同步
  19. php7-soap调用wsdl接口报错:Could not connect to host
  20. Asp.net实现同页面内多图片自动上传并带预览显示

热门文章

  1. 通过OpenVPN来穿越上网(未实践)
  2. NServiceBus入门:发布事件(Introduction to NServiceBus: Publishing events)
  3. nand flash坏块管理OOB,BBT,ECC
  4. android基础知识复习——RelativeLayout布局属性、背景、半透明设置(XML设置)
  5. DEBUG : Eclipse&#160;Debug&#160;时出现&#160;Cannot&#160;connect&#160;to&#160;VM&#160;select&#160;failed错误
  6. 第六章在U盘上运行openwrt(引导)--补
  7. 解决kylin报错:Failed to create dictionary on &lt;db&gt;.&lt;table&gt;, Caused by: java.lang.IllegalArgumentException: Too high cardinality is not suitable for dictionary
  8. nano命令,vi ed pico sed joe emacs jed ex
  9. RMAN备份与恢复之概念一
  10. shell学习:几道常见shell习题