今天做个小项目,用的是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. spring bean的装载过程简略赏析

    spring一个bean的容器,它从这个最基本的功能进而扩展出AOP,transaction,cache,schedule,data等等,将业务与框架代码解耦,让我们可以将大部分精力投入到业务代码中, ...

  2. HashMap中使用自定义类作为Key时,为何要重写HashCode和Equals方法

    之前一直不是很理解为什么要重写HashCode和Equals方法,才只能作为键值存储在HashMap中.通过下文,可以一探究竟. 首先,如果我们直接用以下的Person类作为键,存入HashMap中, ...

  3. [codevs1049]棋盘染色<迭代深搜>

    题目链接:http://codevs.cn/problem/1049/ 昨天的测试题里没有打出那可爱的迭代深搜,所以今天就来练一练. 这道题其实我看着有点懵,拿着题我就这状态↓ 然后我偷偷瞄了一眼hz ...

  4. 一夜搞懂 | JVM 字节码执行引擎

    前言 本文已经收录到我的 Github 个人博客,欢迎大佬们光临寒舍: 我的 GIthub 博客 学习导图 一.为什么要学习字节码执行引擎? 代码编译的结果从本地机器码转变为字节码,是存储格式发展的一 ...

  5. docker下搭建nginx

    一.拉取nginx镜像 # docker pull nginx 等待下载完成后,我们就可以在本地镜像列表里查到 REPOSITORY 为 nginx 的镜像. 二.运行容器 以下命令使用 NGINX ...

  6. 简单记录下springboot+jms+activemq

    1. 安装ActiveMQ 到Apache官方网站下载最新的ActiveMQ的安装包,并解压到本地目录下后运行 2. pom.xml引入  springboot配置文件中填写相关配置 3.创建生产者 ...

  7. git 从另一个分支融合部分文件

    # git checkout master # git checkout anotherBranch -- abc ./etc # git commit -m "merge some fil ...

  8. Git-flow 使用笔记

    git-flow 原理:A successful Git branching model,两篇不错的中文翻译: Git开发管理之道,一个成功的Git分支模型. 简单来说,git-flow 就是在 gi ...

  9. Linux如何配制Tcl编程环境

    首先,打开终端. 接着在终端输入以下命令: sudo apt-get install tcl

  10. R语言—如何安装Github包的解决方法,亲测有效

    R语言—如何安装Github包的解决方法,亲测有效 准备安装材料: R包-REmap GitHub下载地址:https://github.com/lchiffon/REmap R包-baidumap ...