Struts2 表的提交报错 :No result defined for action net.zdsoft.eis.base.data.action.BasicSemesterAdminActio
来源:互联网 发布:sql语句里日期取变量 编辑:程序博客网 时间:2024/06/11 04:29
在开发中总遇到这个问题,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);
}
原因: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);
}
0 0
- Struts2 表的提交报错 :No result defined for action net.zdsoft.eis.base.data.action.BasicSemesterAdminActio
- struts2上传图片linux报错:Exception Name: No result defined for action com.enation.app.base.core.action.Adv
- 使用struts2的标签报错No result defined for action and result input
- struts2第二次提交页面提示no result defined for action
- 报错:No result defined for action and result input
- struts2报错: No result defined for action and result input
- 关于struts2上传文件报错“No result defined for action and result input”
- 关于struts2上传文件报错“No result defined for action and result input”
- Struts2 项目报错 No result defined for action com.xxx.xxAction and result input
- Struts2报错:No result defined for *action and result input
- Struts2报错提示:No result defined for action and result invalid.token
- 关于struts2 No result defined for action
- action莫名报错 No result defined for action com.action.Logout and result success
- struts2出现No result defined for action。。。。。问题的解决办法
- Struts2的Convention插件导致”No result defined for action”
- SSH 报错信息No result defined for action
- SSH 报错信息No result defined for action
- struts2问题,报错:No result defined for action 解决思路
- PHP底层工作原理
- TranslateAnimation动画结束后位置闪烁问题
- mysql创建定时任务
- TranslateAnimation详解
- Mac下cocos2dx-3.2+Xcode环境配置和项目创建
- Struts2 表的提交报错 :No result defined for action net.zdsoft.eis.base.data.action.BasicSemesterAdminActio
- 50个Bootstrap扩展插件
- undefined reference to rpl_malloc
- java 自旋锁(可重入且无死锁)
- MemSQL、SQLFire、Oracle XE性能对比测试
- 13暑假-14暑假周年总结
- 如何在ArcMap中创建网络分析图层
- poj-1663
- 使用 Socket 通信实现 FTP 客户端程序