问题背景:
在一个JSP页面中需要动态跳转到另外一个Action(不是当前页Form的Action),需要向这个Action传递一个当前Form中没有的属性值,因此在jsp而面中追加了类似如下的属性:
<input type="hidden" id="driverid" name="driverid" value="" />
<input type="hidden" id="drivername" name="drivername" value="" />
结果目标Action怎么都无法进入,根本就运行不到Action中去,页面抛出以下异常信息:
Struts Problem Report
Struts has detected an unhandled exception:
Messages:
No result defined for action com.kotei.smbcloud.web.action.statisticevaluate.StatisticEvaluateAction and result input
File: file:/E:/workspace_odc5/.metadata/.plugins/org.eclipse.wst.server.core/tmp2/wtpwebapps/SMBCloud/WEB-INF/classes/struts.xml
Line number: 194
Column number: 84
<!-- Station Manage end-->
<!-- ????? -->
<action name="statistic_evaluate_*" class="statisticEvaluateAction" method="{1}">
<result name="toInitPage">/jsp/statisticEvaluate/evaluateMgr.jsp</result>
<result name="showEvaluate">/jsp/statisticEvaluate/showStatisticEvaluate.jsp</result>
Stacktraces
No result defined for action com.kotei.smbcloud.web.action.statisticevaluate.StatisticEvaluateAction and result input - action - file:/E:/workspace_odc5/.metadata/.plugins/org.eclipse.wst.server.core/tmp2/wtpwebapps/SMBCloud/WEB-INF/classes/struts.xml:194:84
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:273)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
原因:
纠结来纠结去,还查了半天,最终自己摸清楚原因了。原来是自己在jsp页面中追加了相关的隐藏属性,但当前页Form中对应的Action中没有定义这个属性,因此Struts2在封装页面参数到当前Action时找不到对应的属性而发生错误。
解决办法:
有两种办法,选其一:
1、在当前页Form对应的Action中也追加相应属性。
2、不使用隐藏Input字段,而使用javaScript动态为Form增加属性,提交表单。
例如:
在jsp中使用相应的link配合js提交表单:
<a class="linkToShowUserStar" href="#" attrdriverid="${item.driverinfo.id }" attrdrivername='${item.driverinfo.username }' attrintStar="5" attryear="${item.year}" attrmonth="${item.month}">${item.evaluate5 }</a>
js动态追加表单属性提交表单(JQuery):
<script type="text/javascript">
$(function(){
$('.linkToShowUserStar').click(function(){
action = "showEvaluateDetail_showUserDetail.action";
//alert($(this).attr("attrdriverid"));
//alert($(this).attr("attrdrivername"));
//alert($(this).attr("attrintStar"));
//alert("strOldCon:" + $('#strMonth').val() + "_" + $('#selectError').val());
form = $("<form></form>");
form.attr('action', action);
form.attr('method', 'post');
input1 = $("<input type='hidden' name='driverid' />");
input1.attr('value', $(this).attr("attrdriverid"));
form.append(input1);
input2 = $("<input type='hidden' name='drivername' />");
input2.attr('value', $(this).attr("attrdrivername"));
form.append(input2);
input3 = $("<input type='hidden' name='intStar' />");
input3.attr('value', $(this).attr("attrintStar"));
form.append(input3);
input4 = $("<input type='hidden' name='strOldCon' />");
input4.attr('value', $('#strMonth').val() + "_" + $('#selectError').val());
form.append(input4);
input5 = $("<input type='hidden' name='strMonth' />");
input5.attr('value', $(this).attr("attryear") + "-" + $(this).attr("attrmonth"));
form.append(input5);
form.appendTo("body");
form.css('display', 'none');
form.submit();
return false;
});
});
</script>
分享到:
相关推荐
jsp\No result defined for action and result input.doc
No result defined for action.doc
RF and Digital Signal Processing for Software-Defined Radio: A Multi-Standard Multi-Mode Approach by Tony J. Rouphael RF and Digital Signal Processing for Software-Defined Radio: A Multi-...
to present signal processing principles used in the software defined radio, ranging from analog ,digital modulation to RF, DSP and data conversion.
linux ls find 时大于2G文件时出现Value too large for defined data type 系统本身支持大于2G文件但查询有问题的解决办法
Software-defined radios (SDRs) have been around for more than a decade. The first complete Global Positioning System (GPS) implementation was described by Dennis Akos in 1997. Since then several ...
struts1.3.9 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the ...
and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal ...
Software_Defined_Radio_using_MATLAB_Simulink_and_the_RTL-SDR第三章中文翻译版
3G软件无线电software defined radio for 3G,很不错,可惜是英文的,
网上的东西好大多都不能直接用,自己结合网上资料做了一个Struts2+Spring3+MyBatis3的测试工程,JUnit测试用例和WEB服务。 内涵完整jar包,解压直接可用,包括一个表文件。 Eclipse3.2+Tomcat/5.5+jdk1.5.0_17 - ...
Software Defined Radio Architectures, Systems and Functions
以上这篇解决Pycharm下面出现No R interpreter defined的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持软件开发网。 您可能感兴趣的文章:pycharm 使用心得(九)解决No Python ...
高结晶性Na2Zn3[Fe(CN)6]2正极的合成及其电化学性能研究,吴晨,钱江锋,本文,我们报道了一种简单的共沉淀反应制备六方晶系 Na2Zn3[Fe(CN)6]2纳米颗粒(~300 nm)。电化学测试表明,该材料具有可逆的嵌钠反应行
are defined for these two systems. It is shown that the performance index functions are equivalent and the optimal consensus control problem of the input-delayed system can be cast into that of the ...
中文译名《软件无线电中的射频与数字信号处理》,不可多得的一部实用的软件无线电著作,可以当作手册,供工程人员参考借鉴。
The valid characters are defined in RFC 7230 and RFC 3986 错误 问题出在 高版本的tomcat会对请求头进行过滤 我的项目使用的springboot版本是2.2.5版本, 内置的tomcat 版本是9.0.31。 解决方法①(推荐) 新增...
Stops the action invocation immediately (by throwing a PauseException) and causes the action invocation to return the specified result, such as Action.SUCCESS, Action.INPUT, etc. void ...
Learn to:Control storage costs,Eliminate storage bottlenecks,Use IBM GPFS to solve storage management challenges