struts 配置
来源:互联网 发布:mac 串口调试工具 编辑:程序博客网 时间:2024/06/05 17:21
struts配置分手动配置和MyEclipse自动配置
手动配置
1、登录 http://struts.apache.org/download.cgi 站点,下载strut2最新版本。
将Struts 2 的lib文件夹下的一些必须类库复制到web应用的web-inf/lib目录下
2、编辑Web应用的web.xml配置文件,配置Struts2的核心Filter
<!-- 定义Struts2的核心Filter -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<!--让Struts2的核心Filter拦截所有的请求 -->
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
3、在src目录下新建一个struts.xml的配置文件
<package name="resultType" extends="struts-default"> //name可以自己任意取, extends继承struts-default.xml
<action name="testResultType" class="com.etc.action.TestResultAtion"> // action name jsp页面有用,class 对应的action类
<result name="success" type="dispatcher">/welcome.jsp</result> //name 默认是 "success" type 指定的动作 默认 dispatcher 重定向
</action>
</package>
上面是个大概的配置框架。
Myeclipse自动配置
1、新建web项目,选中项目右键 Myeclipse --> add struts Capabilities 配置基本成功,接着就可以在struts.xml里配置action信息了
- struts学习---配置struts
- struts-配置struts
- struts配置
- Struts配置
- struts配置
- Struts配置
- 配置struts
- struts配置
- 配置Struts
- Struts配置
- struts 配置
- struts配置
- struts配置
- struts配置
- 配置Struts
- struts 配置
- 配置Struts
- struts 配置
- SQLExpress 无法启动解决方法
- 寄存器与缓存的区别
- [全文检索]用PHP调用Lucene包来实现全文检索
- ExtJs的Reader
- C陷阱与缺陷笔记
- struts 配置
- 列保存多个数据时一列变多行
- VC 全屏截图 局部截图
- 关于项目中的图片上传、并显示问题
- 数据结构笔记-二叉排序树
- 纯虚函数的默认实现
- 我答知乎:怎么理解“用户的历史行为比他们当前的意愿更有价值”?
- Android 电话拨号
- 学习“内核中的延迟”