s2h-HTTP Status 404 - No result defined for action and result input错误解决
Posted Ashin5800
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了s2h-HTTP Status 404 - No result defined for action and result input错误解决相关的知识,希望对你有一定的参考价值。
今天做个小项目,用的是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; } }
总结:
以上是关于s2h-HTTP Status 404 - No result defined for action and result input错误解决的主要内容,如果未能解决你的问题,请参考以下文章
Http 错误:"status":404,"error":"Not Found","message":"No
HTTP Status 404 - No result defined for action com.csdhsm.struts.action.LoginAction and result error
HTTP Status 404 - No result defined for action com.ouyang.action.GreetingAction and result success 错
HTTP Status 404 - There is no Action mapped for namespace [/] and action name [product-save] associa