No result defined for action

在开发中总遇到这个问题,No result defined for action:
原因:Action中的属性值为空的时候,Struts2的默认拦截器会报错,但是又找不到input的Result,不能够把错误返回,所以报这种错误。

解决方法:
1.在页面中给空值赋默认值。
2.重新定义一个Action,去掉空值的成员变量。
3.添加input的Result,并在这个页面给出提示
--------------------------------------------------------------------------
  当你在用struts2开发时,如果,从页面跳入action时,页面报No result defined for action and result时,大部分的原因有以下几种:

1、validate方法没有通过;

2、页面元素中有重命名时,但后台action类的对应的接收此同名参数的是变量而没有写成数组


 
要检查这种错误时,可以
1,在后台action类中重写ActionSupport中的
void addActionError(String anErrorMessage)
void addActionMessage(String aMessage)
void addFieldError(String fieldName, String errorMessage)
这三个方法,在并在其实现代码中设置断点,监控传入的参数,并可获知页面的相关报错具体原因.
2,在页面中加入以下标签,将错误显示出来 :

< div style =”color:red” >
    < s:fielderror />
</ div >

--------------------------------------------------------------------------

  public void addActionError(String anErrorMessage){
   String s=anErrorMessage;
   System.out.println(s);
  }
  public void addActionMessage(String aMessage){
   String s=aMessage;
   System.out.println(s);
  
  }
  public void addFieldError(String fieldName, String errorMessage){
   String s=errorMessage;
   String f=fieldName;
   System.out.println(s);
   System.out.println(f);
  
  }

Data-Structures-and-Algorithm-Analysis-in-Java.pdf 作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo... 立即下载

相关推荐

爆改YOLOv8 | PSA注意力机制融合入YOLOv8

yolov8,PSA注意力,即插即用

weixin_43986124的博客 2496

JAVA web项目中的no result defined for action xxxAction and result input 错误

No result defined for action and result input 产生这个错误的原因:Action中的属性值为空的时候,Struts2的默认拦截器会报错,但是又找不到input的Result,不能够把错误返回,所以报这种错误。 从上面可知,能够导致 No result defined for action result input 这种错误可能是因为: 1、v...

kt1776133839的博客 2663

头歌 DNS协议分析第3关----DNS 报文分析

DNS 报文分析

qq_67667368的博客 4344

No result defined for action ....Action and result input

异常:No result defined for action ....Action and result .... 原因:action中的返回结果和Struts里配置的结果名称不一致。 解决办法:名称修改统一。

hebeiuniversityof的博客 946

MDK5 Debug调试方法总结

MDK5 Debug调试方法总结

m0_70748084的博客 2万+

# 解决 win11 连接共享打印机,报错 0x00000709 问题

# 解决 win11 连接共享打印机,报错 0x00000709 问题

段子手168的博客 9万+

struts2配置文件中result的input问题

使用struts2验证框架时,当验证错误跳转到input页面会引起整个系统报错。     此问题主要还是因为整合Spring默认的初始化为单例模式,所有的action共用一个实例。     解决方法:   将Spring核心配置文件里的你的依赖注入action的范围改为scope=“prototype”,scope改为prototype就不是单例模式了。  ...

cczakai的专栏 438

实战:如何通过修改VTS和HTS调整GC4653 sensor帧率(附完整计算步骤)

本文以GC4653图像传感器为例,详细解析了通过修改VTS和HTS寄存器来精确调整输出帧率的完整流程。文章深入剖析了帧率计算公式FPS = PCLK / (VTS × HTS)的核心原理,并提供了从获取寄存器参数、计算目标VTS值到系统验证的实战步骤,帮助工程师掌握独立优化Sensor性能、提升低照度画质的关键技能。

gin88的博客 338

No result defined for action and result input异常

分享一下引发这个上述异常的原因 1.    正如提示的,可能没有给相应的action配置相应的result 2.    配置package时没有给namesapce属性配置”/” 3.    在action中使用了validdate方法,但是没有配置名为input的result页面   上面是我自己遇到的错误,以下摘自网上大神: 1.   页面中是否有重名的控件,就是说页面中的控件或隐

BoLann的博客 940

VTK:vtkAssembly用法实战

VTK:vtkAssembly用法实战程序输出程序完整源代码 程序输出 程序完整源代码 #include <vtkActor.h> #include <vtkAssembly.h> #include <vtkAxesActor.h> #include <vtkCubeSource.h> #include <vtkNamedColors.h> #include <vtkNew.h> #include <vtkOrientation

希望我的博客,能帮上你解决学习中工作中所遇到的问题 932

VB.net:VB.net编程语言学习之ADO.net基本名称空间与类的简介、案例应用(实现与SQL数据库编程案例)之详细攻略

ADO.net有六个基础名称空间,除此之外,每个新的数据提供程序还可以有自己的名称空间,如Oracle。在.net中就提供了System.Data.OracleClient名称空间(用于Microsoft建立的Oracle数据库提供的程序)ADO.net体系结构的另一个核心元素是.Net数据提供程序(Data Provider),它的组件用于进行数据处理(和DataSet的数据访问功能相对应)。:是ADD.net核心名称空间,它包含所有数据提供程序使用的类,这些类表示表、列、行,还有DataSet类;

头部AI社区如有邀博主AI主题演讲请私信—心比天高,仗剑走天涯,保持热爱,奔赴向梦想!低调,专注,谦虚,自律,反思,成长,还算比较正能量的博主,公益免费传播…内心特别想在AI界做出一些可以推进历史进程影响力的技术(兴趣使然,有点小情怀,也有点使命感呀 1731

JAVA web项目中的no result defined for action result input 错误

no result defined for action result input

小鱼的专栏 1万+

华为OD机试双机位C卷-热点网站统计 (Py/Java/C/C++/Js/Go)

华为OD机试双机位C卷 热点网站统计,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解。 华为od机考真题 - 热点网站统计。

qq_45776114的博客 779

Java表单提交时No result defined for action异常

今天遇到了一个异常,调了好久终于搞定了。  异常:No result defined for action com.jpsycn.kfwggl.system.action.KeyWordAction and result input... 原因:Action中的属性值为空的时候,Struts2的默认拦截器会报错,但是又找不到input的Result,不能够把错误返回,所以报这种错误   ...

香辣虾虾 955

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

Struts2框架下提交action时报No result defined for action or result input

开发中在java开发中在struts框架下提交action的时候总报错,No result defined for action or result input: 出现这种错的原因:在提交action的时候,其对应的属性值为空或错误值导致数据类型转换失败进而导致structs2的默认拦截器报错,找不到input的Result,不能把错误信息返回。   可能造成这种错误的情...

anli2302的博客 337

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Struts:No result defined for action daiwei.struts.action.UserAction and result success

Struts:No result defined for action daiwei.struts.action.UserAction and result success 问题描述: 我试图测试Struts传递对象参数User Action 代码如下(省略了属性的set和get方法): public class UserAction extends ActionSupport {

戴唯的博客 6577

No result defined for action and result success 的问题

整合ssh 的时候     /success.jsp    /success.jsp      页面调用        一直报No result defined for action and result success 的错 action中打个断点程序了而且没什么错误,找了半天竟然是namespace的问题 .namespace="/" 再试一把  跳转成功了!     其实

牵手*-*白首 7117

No result defined for action and result

在struts2开发中碰到这么个错误No result defined for action and result大部分的原因有以下几种: 1、validate方法没有通过; 2、页面元素中有重命名时,但后台action类的对应的接收此同名参数的是变量而没有写成数组,这个极有可能,我就碰到过,搞了好久才发现是这个原因   3、你在页面使用了&lt;s:actionerror/&gt;标签,而...

梦想成为摇滚中医的程序员的专栏 211

No result defined for action *Action and result input - action

<br /> No result defined for action *Action and result input - action - <br /><br />message <br /><br />description The server encountered an internal error () that prevented it from fulfilling this request. <br /><br />exception <br /><br />No

gudong2945的专栏 1万+

解决 No result defined for action xxxAction and result input

直接提交http://localhost:8080/struts-timerInterceptor/userLogin.action 访问时出现No result defined for action xxxAction and result input错误解决办法:struts.xml中 result name 中error小写...

qq_32218473的博客 5957

No result defined for action and result input

在换项目后,用ftp上传一直不进action 页面报错 No result defined for action and result input 首先想到的是sturts.xml中配置result的name为input。配置后还是没能解决问题,而且报了没有空的空指针的问题?(bug了下,确实有值,但是就报空指针)。最后各种搜索,各种尝试在form表单加enctype="multipart/for

错误集中营 1280

Struts2 -- No result defined for action action.Register and result success

Struts2 – No result defined for action action.Register and result success   在跟着官网的例子学习Struts 2框架的时候遇到了个问题:No result defined for action action.Register and result success.最后发现是struts.xml里 package的...

Sino_Crazy_Snail的小窝 938

No result defined for action [Struts2中的异常]

问题:  Struts2 开发中出现    No result defined for action  记录我的问题曾出现的环境: 前台使用  Flexigrid  做前台grid控件,Flexigrid  中分页  传递参数  “当前页” 在ajax请求中的参数引用为"page",和后台定义的一个参数page类型不同,导致 Flexigrid  每次请求数据,都会出现 上述问题

yuxiatongzhi的专栏 1436
上一篇: mysql启动报错The server quit without updating PID file (/usr/local/mysql/data/
下一篇: js按钮显示时间
java_doom
博客等级 码龄20年 6粉丝 199原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值