看Struts官方项目一些配置习惯
来源:互联网 发布:php hello world 编辑:程序博客网 时间:2024/06/03 23:48
1、推荐吧JSP文件放到web-info下面
因为struts2拦截器级别是Action级别的拦截器,是不拦截jsp文件的,把JSP文件放到web-info下面是不能直接访问的,只有通过action才可以访问到。
这也导致jsp页面之间的跳转麻烦
2、配置全局结果
<global-results> <result name="error">/WEB-INF/jsp/error.jsp</result> </global-results>
3、配置默认Action处理未知的请求
<default-action-ref name="index" /> <action name="index"> <result type="redirectAction"> <param name="actionName">HelloWorld</param> <param name="namespace">/example</param> </result> </action>
4、使用通配符
其实这个东西永远是约定大于配置
//{1}就代表*号内容 <action name="*" class="example.ExampleSupport"> <result>/WEB-INF/jsp/example/{1}.jsp</result> </action>//这个其实还没有动态方法调用好用 <action name="Login_*" method="{1}" class="example.Login"> <result name="input">/WEB-INF/jsp/example/Login.jsp</result> <result type="redirectAction">Menu</result> </action>//这个要特别注意<action name="List*s" class="actions.List{1}s"> <result>list{1}s.jsp</result></action>ListAccounts搭配、 ListSponsors并不适用,因为ListSponsors映射为<action name="ListSpons" class="actions.ListSpons"> <result>listSpons.jsp</result></action>
0 0
- 看Struts官方项目一些配置习惯
- 个人项目习惯配置gulpfile
- Struts项目环境配置
- struts中的一些常用配置
- 看Google官方的Android开发文档的一些收获
- 一些习惯
- Struts环境配置的一些问题
- 配置struts validation遇到的一些问题
- struts.xml中一些constant配置含义
- 谈下自己的一些编程习惯和一个项目
- 公司项目中controller代码的一些编写习惯
- vim的一些配置,看着不错
- 一个jsp+tomcat+struts项目的配置
- Struts 项目中web.xml文件配置
- Struts 项目中web.xml文件配置
- Struts 项目中web.xml文件配置
- [基础]项目中Struts的配置
- struts----tiles官方例子
- Kali-linux安装之后的简单设置
- 安卓6.0权限处理在项目中的实践
- 递推 HDU 2048 神、上帝以及老天爷
- SweetAlert详解
- 工厂三姐妹——抽象工厂模式
- 看Struts官方项目一些配置习惯
- 第9课:IDEA下的spark程序开发
- 【JS学习笔记】 匿名函数和闭包
- button代码实现点击
- POJ3411 DFS最小计算消费值
- 【B/S】Asp.Net控件总结
- JavaScript的学习整理(四)
- 你为什么要来北京?
- L脚本语言访问XML文件