在开发中总遇到这个问题,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);
  
  }
来自:

http://www.itstrike.cn/Question/9eeeed8e-8a75-4f53-bde7-d0c0a2a6f1e6
以上转自:http://www.blogjava.net/javagrass/archive/2011/07/20/354684.html

HTTP Status 404 - No result defined for action com.hebky.oa.classEntity.action.EntitysAction and result input的更多相关文章

  1. 论坛:Error:No result defined for action cn.itcast.oa.view.action.TopicAction and result

    使用了<s:hidden name="forumId" value="#forum.id"/> 可以改为: <s:hidden name=&q ...

  2. s2h-HTTP Status 404 - No result defined for action and result input错误解决

    今天做个小项目,用的是ssh,结果在运行的时候出现HTTP Status 404 - No result defined for action and result input的错误. 首先认真检查所 ...

  3. HTTP Status 404 - No result defined for action com.csdhsm.struts.action.LoginAction and result error

    智商拙计的问题,没有找到为类LoginAction和error找到定义,然后重新去struts.xml去看,我类个去,我居然把result写成了ERROR <result name=" ...

  4. Struts2.3动态调用报 No result defined for action 错误

    struts 2.3.16  採用动态调用发现不工作报404 not found,网上查找原因: 1.由于:struts2中默认不同意使用DMI 所以:须要在配置文件里打开: <constant ...

  5. Struts2异常:HTTP Status 404 - There is no Action mapped for action name addBook.

    HTTP Status 404 - There is no Action mapped for action name addBook. 在地址栏进行访问的时候,出现了这个错误信息,导致出现此异常的原 ...

  6. 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 ...

  7. no result defined for action

    1.no result defined for action .......and result input    或者 no result defined for action .......and ...

  8. Struts 2.x No result defined for action 异常

      这是我跑struts2的第一个例子,跑的也够郁闷的,这个问题烦了我几个钟... 2011-5-10 10:10:17 com.opensymphony.xwork2.util.logging.co ...

  9. 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的异常,就是在因 ...

随机推荐

  1. Vlc基础数据结构记录

    1.  Vlc基础数据结构 hongxianzhao@hotmail.com 1.1  基础数据结构 struct vlc_object_t,相关文件为src\misc\objects.c. 定义为: ...

  2. bootstrap插件小记

    1.模态框 除了通过data-toggle和data-target来控制模态弹出窗之外,Bootstrap框架针对模态弹出框还提供了其他自定义data-属性,来控制模态弹出窗.比如说:是否有灰色背景m ...

  3. 程序员使用Node的十个技巧

    从问世到现在将近20年,JavaScript一直缺乏其它有吸引力的编程语言,比如Python和Ruby,的很多优点:命令行界面,REPL,包管理器,以及组织良好的开源社区.感谢Node.js和npm, ...

  4. 为 IIS 7.0 配置 <system.webServer>

    Web.config 文件中的 system.webServer 节用于指定适用于 Web 应用程序的 IIS 7.0 设置.system.WebServer 是 configuration 节的子级 ...

  5. C#操作AD的例子

    一下连接中包含了使用c#对AD操作的各种列子 http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-D ...

  6. LogBoy运行截图

  7. c#接口定义与应用

    public interface IBankAccount //只能加public修饰符,或者什么都不加 { void Playin(decimal money); //函数前不加任何修饰符号 boo ...

  8. Unicode与汉字

    当遇到\u7f3a\u5c11  这样形式的字符串时,其实它代表的是汉字   具体的网上可以进行Unicode转中文   翻译

  9. JAVA笔记1-00

    package chapter1; public class Demo1 { public static void main(String[] args) { System.out.println(& ...

  10. linux之grep实例讲解

    文件testgrep内容: 1.显示所有包含San的行   2.显示所有以J开始的人名所在的行 3.显示所有以700结尾的行 4.显示所有不包括834的行    5.显示所有生日在December的行 ...