今天做个小项目,用的是ssh,结果在运行的时候出现HTTP Status 404 - No result defined for action and result input的错误。

首先认真检查所有的配置文件,命名空间,路径,名称都没问题。

于是各种查资料,最后发现,是validate校验器搞的鬼。

分析:

因为我把方法都写在RegisterAction,而检验器文件名为RegisterAction-validation.xml,就是对RegisterAction里的所有方法都起作用,以至于后面我每次查询所有结果时,即调用getAllRegister()方法时, 出现No result defined for action and result input的错误。

后来改成RegisterAction-addRegister-validation.xml,即只对addRegister方法起校验。

问题解决。

package sshlab10.s2h.action;

import java.util.List;

import sshlab10.s2h.dao.HibernateDao;
import sshlab10.s2h.dao.impl.HibernateDaoImpl;
import sshlab10.s2h.entity.Register; import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven; public class RegisterAction extends ActionSupport implements ModelDriven{
/**
*
*/
private static final long serialVersionUID = 1L;
private String password2;
private Register register;
private List<Register> users;
private HibernateDao hibernateDao; public RegisterAction() {
register=new Register();
hibernateDao=new HibernateDaoImpl();
} public String getPassword2() {
return password2;
} public void setPassword2(String password2) {
this.password2 = password2;
} public List<Register> getUsers() {
return users;
} public void setUsers(List<Register> users) {
this.users = users;
} public String getAllRegister() {
users=hibernateDao.getAllRegister();
return "show";
} public String addRegister() {
hibernateDao.addRegister(register);
return SUCCESS;
} @Override
public Object getModel() {
// TODO Auto-generated method stub
return register;
} }

RegisterAction

总结:

s2h-HTTP Status 404 - No result defined for action and result input错误解决的更多相关文章

  1. No result defined for action and result input

    今天在编程的时候,我遇到了No result defined for action and result input的错误,这个错误想必大家都有遇到过吧,我今天发了很长时间弄这个错误,我以为我的Act ...

  2. [Struts2] No result defined for action ... and result input &amp; Invalid field value for field ...

    "No result defined for action ... and result input"错误一般发生在Struts2的拦截器拦截时遇到了问题时.Struts2会将跳转 ...

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

  4. SSH整合报错:No result defined for action and result input

    目前发现这个问题主要是在Action中的execute返回值时,没有对应的result name而引起的.很有可能是由于程序执行中出错了,但是对 应的Action中没有添加 input的result  ...

  5. 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,不能够 ...

  6. no result defined for action

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

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

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

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

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

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

随机推荐

  1. Jmeter接口测试之参数传递(十三)

    在接口自动化测试中,经常会遇到的一种场景就是参数的场景,比如在用户列表中获取所有的用户列表,然后获取到某一个用户的ID,查看该用户的详细信息.首先在这里理清思路,它的流程是,首先获取到数据,然后在Jm ...

  2. python之字符编码与转码

    说起python编码,真是句句心酸,今天终于是,终于梳理清楚了,下面我们就来一起揭开py编码的真相吧! 一,什么是编码? 其实基本概念很简单.我们都知道消息,那么消息就是人类所能理解的,简单易懂的存在 ...

  3. flask中 多对多的关系 主从表之间的的增删改查

    # 角色表模型class Role(db.Model): r_id = db.Column(db.Integer, primary_key=True) r_name = db.Column(db.St ...

  4. Python终端打印彩色文字

    终端彩色文字 class Color_f: black = 30 red = 31 green = 32 yellow= 33 blue = 34 fuchsia=35 cyan = 36 white ...

  5. python opencv 图片缺陷检测(讲解直方图以及相关系数对比法)

    一.利用直方图的方式进行批量的图片缺陷检测(方法简单) 二.步骤(完整代码见最后) 2.1灰度转换(将原图和要检测对比的图分开灰度化) 灰度化的作用是因为后面的直方图比较需要以像素256为基准进行相关 ...

  6. Codeforces 631 (Div. 2) D. Dreamoon Likes Sequences 位运算^ 组合数 递推

    https://codeforces.com/contest/1330/problem/D 给出d,m, 找到一个a数组,满足以下要求: a数组的长度为n,n≥1; 1≤a1<a2<⋯&l ...

  7. markdown 插入图片太大?怎么设定图片大小?

    你一定在插入图片的时候,遇到图片太大,影响观感的问题. Markdown中,图片大小的设定方式有两种 第一种: ![](https://img2018.cnblogs.com/blog/1735896 ...

  8. Centos6升级内核方法

    docker需要内核在3.0以上,如果centos6上需要安装docker的话需要先将内核进行升级 工具/原料   Centos6.5_x64 方法/步骤     操作系统为centos6.5,内核为 ...

  9. 【公告】请访问我Blog新站——superman2014 www.superman2014.com

    http://www.superman2014.com 欢迎光顾 本博客不在更新!!!!

  10. Jquery的$.get(),$.post(),$.ajax(),$.getJSON()用法详细解读

    1.$.get $.get()方法使用GET方式来进行异步请求,它的语法结构为: $.get( url [, data] [, callback] ) 解释一下这个函数的各个参数: url:strin ...