struts2没有打印日志原因和No result defined for action XXXAction and result input
在项目中调用一个action的方法的时候发生了一个错误,但是在catalina.out和配置的log4j都没有打印异常,后来在执行的action中加了logger.error("XXXXX"),也没有打印异常。
后来发现是struts2默认的有异常拦截器ExceptionMappingInterceptor,但是是禁用的,需要自己启用
<interceptor-ref name="defaultStack">
<param name="exception.logEnabled">true</param>
<param name="exception.logLevel">ERROR</param>
</interceptor-ref>
自定义全局异常处理的显示的页面
<global-results>
<result name="error">/public/error.jsp</result>
</global-results> <global-exception-mappings>
<exception-mapping result="error" exception="java.lang.Exception"></exception-mapping>
</global-exception-mappings>
在显示的页面/public/error.jsp也可以显示发生的异常信息
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div class="msgFalse" >
<dl>
<dt>操作失败</dt>
</dl> <s:property value="exception"/>
<s:property value="exceptionStack"/>
</div>
</body>
</html>
异常:No result defined for action XXXAction and result input
1.在action里面定义了某类型的变量,然后想通过struts的自动填装把post来的表单的数据转换,如果转换类型失败就出现此种错误
2.页面提交了同一个名字的参数多个
比如“”
username 123
username 123
permissions 123
info 31234
页面提交了了两个username ,而我的后台却只写了一个String username,这样同样会出错.
3.页面中用到的控件名称与后台Action中的属性名称不一致
这个很好理解,名称不匹配,Struts2是不会给Action中的属性赋值的
struts2没有打印日志原因和No result defined for action XXXAction and result input的更多相关文章
- Struts2报错:No result defined for action xxx and result input
case如下: 1. 后台程序要升级, 修改了一些功能,但是没有修改或者添加action的参数. 2. 数据库需要升级,执行了一些sql,修改过action的值. 3. 当修改某个已经存在的记录,然后 ...
- struts2 No result defined for action XXX and result input
这种错误的原因一般是页面的属性和action里的属性个数.名称.类型不一致造成的 困扰了我一下午的问题,原来是表单中有两个input-text的name属性重复了,然后接受参数的时候就出现了这个错误 ...
- Struts2.3动态调用报 No result defined for action 错误
struts 2.3.16 採用动态调用发现不工作报404 not found,网上查找原因: 1.由于:struts2中默认不同意使用DMI 所以:须要在配置文件里打开: <constant ...
- [Struts2] No result defined for action ... and result input & Invalid field value for field ...
"No result defined for action ... and result input"错误一般发生在Struts2的拦截器拦截时遇到了问题时.Struts2会将跳转 ...
- Struts2问题,已解决No result defined for action and result input
struts2.1.8 必须在struts.xml中配置namespace属性 如果你在2.0中一切OK,但是在2.1中确出现了No result defined for action的异常,就是在因 ...
- No result defined for action com.lk.IndexAction and result success
意图访问一个 /es/index.action 竟然出现: [SAE ] ERROR [05-11 13:54:32] [http-80-5] com.opensymphony.xwork2.util ...
- Struts 2.x No result defined for action 异常
这是我跑struts2的第一个例子,跑的也够郁闷的,这个问题烦了我几个钟... 2011-5-10 10:10:17 com.opensymphony.xwork2.util.logging.co ...
- HTTP Status 404 - No result defined for action com.hebky.oa.classEntity.action.EntitysAction and result input
在开发中总遇到这个问题,No result defined for action:原因:Action中的属性值为空的时候,Struts2的默认拦截器会报错,但是又找不到input的Result,不能够 ...
- no result defined for action
1.no result defined for action .......and result input 或者 no result defined for action .......and ...
随机推荐
- finereport 填报 单元格 JS 触发 提交SQL 事件
var location = this.options.location; var cr = FR.cellStr2ColumnRow(location); var col = cr.col; var ...
- 【Python开发】Python之re模块 —— 正则表达式操作
Python之re模块 -- 正则表达式操作 这个模块提供了与 Perl 相似l的正则表达式匹配操作.Unicode字符串也同样适用. 正则表达式使用反斜杠" \ "来代表特殊形式 ...
- 解决应用程序无法正常启动0xc0150002问题(转)
简述:使用VS2008写了一个MFC程序,结果传到别人的机子上(WIN7)出现应用程序正常初始化(0xc0150002)失败的问题.为什么我的机子上可以,而别人的机子上运行不了呢?下面是我找到的一个解 ...
- [转帖]国科微发布纯正国产SSD主控 龙芯IP内核,速度可达500MB/s
国科微发布纯正国产SSD主控龙芯IP内核,速度可达500MB/s https://www.expreview.com/68071.html 自主内核 龙芯处理器. 2019.4. 在存储芯片领域,中国 ...
- 自然语言处理工具hanlp 1.7.3版本更新内容一览
HanLP 1.7.3 发布了.HanLP 是由一系列模型与算法组成的 Java 工具包,目标是普及自然语言处理在生产环境中的应用.HanLP 具备功能完善.性能高效.架构清晰.语料时新.可自定义的特 ...
- 云数据库 MongoDB版
阿里云云数据库MongoDB版是一种安全可靠.可弹性伸缩的云数据库服务,目前支持ReplicaSet和Sharding两种部署架构,通过简单的几步操作即可快速部署.阿里云云数据库MongoDB版是一种 ...
- ABC130 Task F. Minimum Bounding Box
题目链接 题解 最小的 bounding box 一定可以在四个时间段的最左端点和最右端点之间取到. 举例言之,设四个时间段分别是 (2, 5), (7, 10), (4, 9), ( 10, 20) ...
- PHP 网站大数据大流量与高并发 笔记
前端: 1.域名开启cdn 2.大文件使用oss php: 1.模板编译缓存 服务器: 1.负载均衡 数据库: 1.读写分离 待完善
- b/s和c/s
一.B/S结构 B是英文单词“Browser”的首字母,即浏览器的意思:S是英文单词“Server”的首字母,即服务器的意思.B/S就是“Browser/Server”的缩写,即“浏览器/服务器”模式 ...
- 基于Websocket的websocketd
WebSocket是什么 WebSocket是HTML5下面的一种技术,设计出来的目的就是要取代轮询和 Comet 技术,使客户端浏览器具备像 C/S 架构下桌面系统的实时通讯能力. 浏览器通过 Ja ...