在开发中总遇到这个问题,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. 【二分答案】 【POJ3497】 【Northwestern Europe 2007】 Assemble 组装电脑

    Assemble Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3171   Accepted: 1013 Descript ...

  2. [WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored (webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')

    WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored (webxml attribu ...

  3. CodeForces 698A - Vacations (Codeforces Round #363 (Div. 2))

    要么去体育馆,要么去比赛,要么闲在家里 给出每一天体育馆和比赛的有无情况,要求连续两天不能去同一个地方 问最少闲几天 DP方程很容易看出 dp(第i天能去的地方) = min(dp(第i-1天的三种情 ...

  4. BestCoder 2nd Anniversary 1002 Arrange

    排除所有不符合条件后根据当前位置上下界计算, 由于前面取的数肯定在之后的区间内,所以去掉已取的个数即可. #include <iostream> #include <cstdio&g ...

  5. W - stl 的 优先队列 Ⅲ

    Description In a speech contest, when a contestant finishes his speech, the judges will then grade h ...

  6. 关于web标准的理解(转)

    从开始接触所谓web标准化,差不多也有两年多的时候了吧.从最初的疑惑和彷徨一直到现在,经历了每一个阶段.这段过程是痛苦的也是开心的,痛苦的是这个过程中没有人可以帮你答疑解惑,所有的问题都要你自己去解决 ...

  7. android studio error configuration with name default not found

    Android Studio报错: android studio error configuration with name default not found 在进行sync的时候,提示Error: ...

  8. source install MacPorts--checking for Tcl configuration... configure: error: Can't find Tcl configuration definitions

    If you installed MacPorts using the package installer, skip this section. To install MacPorts from t ...

  9. 如何设置 Internal 类,方法,属性对其他项目可见

    internal 修饰符时程序集内部其他类可见.但对程序集外的类不可见,这样就很好的封装了可见性. 但是,我们也许会碰到类似的情况,特别是基于已有代码开发新的代码时,你会发现很多 internal 的 ...

  10. 如何有效地配置基于Spring的应用系统

    Spring为应用系统的开发提供了极大的方便,其IoC反向注入(或DI依赖注入)的概念也彻底地改变了旧的编程方式,让我们只需关注如何使用对象,而创建对象交给Spring去完成,即把使用对象和创建对象分 ...