struts 中default-action-ref的问题
来源:互联网 发布:python 爬虫 设置延时 编辑:程序博客网 时间:2024/05/21 19:25
最近使用struts 时, 发现配置struts 时产生的一个问题。使用default-action-ref 并不能达到所属的相应效果。
按照struts文档所说, default-action-ref 的作用:
Usually, if an action is requested, and the framework can't map the request to an action name, the result will be the usual "404 - Page not found" error. But, if you would prefer that an omnibus action handle any unmatched requests, you can specify a default action. If no other action matches, the default action is used instead.
但是真的不是这样。。。
以下是我的struts.xml相应配置:
<package name="admin" namespace="/admin" extends="struts-default"><default-action-ref name="index"></default-action-ref><action name="index"><result>/admin/index.html</result></action><action name="*_*" class="com.joey.bbs3s.action.{1}Action"method="{2}"><result>/admin/{1}_{2}.jsp</result><result name="input">/admin/{1}_{2}.jsp</result><exception-mapping result="error" exception="java.sql.SQLException"></exception-mapping><result name="error">/error.jsp</result></action></package>
想法很简单, 就是当/admin下面没有和 输入相匹配的action时,帮我映射到/admin/index 这个action。
实验结果:
(首先/admin/index 正常)
(没有action 可以匹配/admin/aaaaaaaa)
根据错误信息,推测可能与在package 中设置的通配符相关。
解决方案:
1. 在web.xml中设置(还未进行实验)
2.http://blog.sina.com.cn/s/blog_9772ef170101dczo.html 修改通配符的设置
0 0
- struts 中default-action-ref的问题
- struts.xml中的default-action-ref问题
- struts.xml中的default-action-ref问题
- struts.xml中的default-action-ref问题
- <default-action-ref>的用法
- 关于struts2中default-action-ref的一些问题,首页设置
- 关于struts2中default-action-ref的一些问题及首页设置
- 关于struts2中default-action-ref的一些问题及首页设置
- struts2中对于default-action-ref配置的解析思路
- struts2中对于default-action-ref配置的解析思路
- struts2中对于default-action-ref配置的解析思路
- struts2中对于default-action-ref配置
- Tomcat struts xml文件报错:"(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?..
- 关于 default-action-ref 的一个BUG
- 关于default-action-ref的思考
- 关于default-action-ref标签不能访问相应的class中的action问题的解决方案
- Struts2---->default-action-ref
- Webwork配置文件中interceptors,result-types,global-results,default-interceptor-ref,action标签顺序问题
- Android文档——进程优先级与线程
- Fail to create the java Virtual Machine
- Java-HttpServletResponse-HttpServletResponseWrapper
- maven卸载强制性依赖
- Android面试题及答案8
- struts 中default-action-ref的问题
- win10 关键错误:开始菜单与cortana打不开
- 数论——最大公约数和最小公倍数算法
- osgi系列之二 集成log4j
- Code 39码与Code 128码区别
- 从《孙子兵法》看管理
- C++构造函数语意学 - Constructor(The Semantics of Constructors)
- 信号量的PV操作实例
- android:windowSoftInputMode属性详解