首页 > 其他 > 详细

No result defined for action com.nynt.action.ManageAction and result input问题

时间:2019-04-17 16:43:13      阅读:112      评论:0      收藏:0      [点我收藏+]

No result defined for action com.nynt.action.ManageAction and result input 问题原因:

1)、 在action类中定义的一个return "input";在xml文件里没有东西接收。

?????????? 举例说明:

???????????????????? struts.xml 文件:

?? <package name="file" namespace="/file" extends="struts-default">
?
?? ?? <action name="inputFile" class="action.FileAction" method="inputFile">
?? ???? <result name="success">/index.jsp</result>
?? ?? </action>

? </package>


action类文件:

public String inputFile(){
?? ??? ?System.out.println(hh);
?? ??? ?return "input";
?? ?}

此时会报这样的异常


2)、struts拦截器无法将前台类型与后台类型匹配报出异常,此时进不了后台

举例说明:
?? ???? jsp页面:
?? ??? ??? <form action="file/inputFile.action" method="post" enctype="multipart/form-data">
?? ?? ? ? ? <input type="text" name="hh" value="aa"/>
? ?? ??? ?<hr/>
? ?? ??? ?<input type="submit" value="上传"/>
? ? ? ? ? </form>

????? action类文件:

????????????? private int hh;

???????????? public String inputFile(){
?? ??? ?????????? System.out.println(hh);
?? ??? ? ? ? ? ? return "success";
?? ? ? ? ?? }

????????

?? ??? ??? action 中 aa 为 int 类型有 setter 和g etter 方法,此时报出此异常

????????????? 这是因为struts的拦截器没有办法将value里面的“aa”强制转化成int类型


???? 假设jsp页面有两个<input type="text" value="bb" name="hh"/>? name值同样
?? ??? ?里面的类型都是能够强制转化成 int 的,可是struts的拦截器没有办法拼接
?? ??? ?所以也会报出类型不匹配错误,即这个异常。

No result defined for action com.nynt.action.ManageAction and result input问题

原文:https://www.cnblogs.com/xfgnongmin/p/10724425.html

(0)
(0)
   
举报
评论 一句话评论(0
分享档案
最新文章
教程昨日排行
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!