一、Stru ts2和 Spring 整合,创建一个 OA 工程 1、整合 stru ts2 1)导入strut2的jar包:commons-logging-1
jar,freemarker-2
jar,ognl-2
jar,struts2-core-2
jar,xwork-2
暂时导入这些 jar 包,到时候需要再倒入
2)将 struts
xml 文件放置在 OA 工程的 src 目录下
3)在 web
xml 里面配置 struts2用到的核心过滤器
Xml 代码 struts2 org
apache
struts2
dispatcher
FilterDispatcher struts2 /* 2、整合 spring 1)导入 spring 的 jar 包:spring
jar 2)将 applicationContext
xml 文件放置在 OA 工程的 WEB-INF 目录下
3)在 web
xml 里面配置 spring 用到的监听器
Xml 代码 org
springframework
context
ContextLoaderListener 4)添加 struts2-spring 整合的插件:struts2-spring-plugin-2
jar,如果不使用这个插件,则需要在 struts
xml 里面配置: Xml 代码 3、测试 stru ts2和 spring 整合对不对
写一个 jsp 页面 login
jsp 来测试: Html 代码 Insert title here 写一个 LoginAction Java 代码 package com
struts2
action; import com
opensymphony
xwork2
ActionSupport; im