Struts:No result defined for action daiwei.struts.action.UserAction and result success
来源:互联网 发布:机械能守恒实验带数据 编辑:程序博客网 时间:2024/05/21 09:10
Struts:No result defined for action daiwei.struts.action.UserAction and result success
问题描述:
我试图测试Struts传递对象参数User
Action 代码如下(省略了属性的set和get方法):
public class UserAction extends ActionSupport {
private String name;
private int age;
private User user;
private String mes;
public String add() {
if(name == null || !name.equals("admin")) {
this.addFieldError("name", "name is error");
this.addFieldError("name", "name is too long");
return ERROR;
}
return SUCCESS;
}
public String addUser() {
String userName =user.getName();
this.mes="user add success!";
return SUCCESS;
}
}
Struts.xml中的配置
<action name="user" class="daiwei.struts.action.UserAction" method="add">
<result>/action/user_add_success.jsp</result>
<result name="error">/action/user_add_error.jsp</result>
</action>
访问路径为:http://localhost:8080/struts2/action/myUser!addUser?user.name=dd
错误代码为:
No result defined for action daiwei.struts.action.UserAction and result success
原因和解决方案:
因为在Struts.xml配置中,action的名字”user”,可能为保留关键字,所以会出现以上错误,将action的名字改为”myUser”,解决以上错误。
- Struts:No result defined for action daiwei.struts.action.UserAction and result success
- struts异常:No result defined for action and result success
- HTTP Status 404 - No result defined for action com.tencent.action.UserAction and result success
- No result defined for action action.UserAction and result input
- No result defined for action action.LoginAction and result success
- No result defined for action action.LoginAction and result success
- No result defined for action Action.calculation and result success
- No result defined for action action.LoginAction and result success
- No result defined for Action and result success
- No result defined for action and result success 的问题
- No result defined for action jsp_entity.SysLog and result success
- No result defined for action *** and result success
- No result defined for Action and result success
- No result defined for action and result success
- struts---No result defined for action org.crazyit.app.action.LoginAction and result error
- No result defined for action com.svse.action.UserAction and result input
- SSH报错:No result defined for action com.tyzy.action.user.UserAction and result input
- No result defined for action com.web.action.UserAction and result input
- 电商之(LB)梳理F5(4层)---反向代理以及负载均衡
- Intersection of Two Linked Lists
- iOS UI 技巧: 视图无法被点击
- 电商之梳理Nginx(7层)相关知识---反向代理以及负载均衡
- Android异步消息处理机制完全解析,带你从源码的角度彻底理解
- Struts:No result defined for action daiwei.struts.action.UserAction and result success
- 电商之梳理varnish相关知识---http协议加速器
- ThinkPHP中的$this->success()与$this->error()方法的使用
- 制作Linux版PE系统
- java/android 设计模式学习笔记(8)---桥接模式
- 实习杂记(20)---Android里面shape定义图形相关属性
- IntelliJ IDEA 的 20 个代码自动完成的特性
- Numeric Validation
- HDU 1689 Just a Hook (线段树)