下面是我的代码的一部分:strurs全局error配置: <package name="default" extends="struts-default">
<global-results>
<result name="error">/jsp/common/error.jsp</result>
<result name="invalid.token">/jsp/common/error.jsp</result>
<result name="exception">/jsp/common/error.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping result="exception" exception="java.lang.Exception" />
</global-exception-mappings>
</package>
Action public String list() throws Exception {
try {
//Integer.parseInt("aa");//故意制造错误,从而转入error页面
//addActionError("bb");//添加addActionError,以期跳转到Input页
map.clear();
map = DBHelper.getDefaultRequestMap4Page();//得到pageSize和Current的Map
this.setGroups(dao.list(map));//用dao方法得到list列表
} catch (Exception e) {
log.error(this.getClass().getName() + "!list 读取数据错误:" + ToolsUtil.getStackTrace(e));
throw new Exception(this.getClass().getName() + "!list 读取数据错误:" + ToolsUtil.getStackTraceHTML(e));
}
return SUCCESS;
}但是我一把
addActionError("bb");
这句的注释去掉,程序就变成了死循环................请问这是为何?????????????
<global-results>
<result name="error">/jsp/common/error.jsp</result>
<result name="invalid.token">/jsp/common/error.jsp</result>
<result name="exception">/jsp/common/error.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping result="exception" exception="java.lang.Exception" />
</global-exception-mappings>
</package>
Action public String list() throws Exception {
try {
//Integer.parseInt("aa");//故意制造错误,从而转入error页面
//addActionError("bb");//添加addActionError,以期跳转到Input页
map.clear();
map = DBHelper.getDefaultRequestMap4Page();//得到pageSize和Current的Map
this.setGroups(dao.list(map));//用dao方法得到list列表
} catch (Exception e) {
log.error(this.getClass().getName() + "!list 读取数据错误:" + ToolsUtil.getStackTrace(e));
throw new Exception(this.getClass().getName() + "!list 读取数据错误:" + ToolsUtil.getStackTraceHTML(e));
}
return SUCCESS;
}但是我一把
addActionError("bb");
这句的注释去掉,程序就变成了死循环................请问这是为何?????????????
解决方案 »
- SSH+JQuery Ajax数据延迟加载的问题
- 高分求助:一天没解决了,好人抽个空帮个忙,散分了ajax+json存List 不到Success函数
- 帅哥美女们 救命啊 报错了!! spring aspectjweaver
- 请推荐一个开源的Web聊天平台框架
- 刚毕业,学的是java(java EE方向的),为了得到一份工作转做PHP可以么?
- 如何利用java代码上传大量文字到数据库
- 服务器端如何判断上传Excel 小于2M的允许上传 -----------------------------救命啊。。。。。。
- 用main函数来测试ejb的sessionBean,运行到context = new InitialContext()时,出现如下错误.......
- 如何通过jdbc连接装在sco unix上的sybase数据库
- 服务器上部署了项目,tomcat7,jdk1.7,,用火狐浏览器打开,有时候会报错,错误如下,,求大神赐教
- 大哥大姐帮个忙啊??急..................
- 不能找到xmlrpc的包
2)Struts2发现错误列表中信息非空,故而跳转至input页面(即调用list()方法的页面)
3)不幸的是,该input页面会再次调用addActionError("bb");所以你又回到了1)PS:以上为猜测,或者说过去看过,但记不清了,或者是以为自己看过,但记不清了
<global-results>
<result name="input">/jsp/common/input.jsp</result>
<result name="error">/jsp/common/error.jsp</result>
<result name="invalid.token">/jsp/common/error.jsp</result>
<result name="exception">/jsp/common/error.jsp</result>
</global-results>
来验证我的想法,谢谢!
(input.jsp请不要调用其它方法)
报出的错误是堆栈错误,我去查了一下...是apache陷入死循环才会报的错误回2楼的:
<result name="input">/jsp/common/input.jsp </result>我一早就加过的,就是因为出了死循环,所以我去掉了.....
但是这个公用页面里面没有addActionError这语句啊....还是不知道原因...额....