首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

struts2 配置的action路径找不到

2012-05-28 
求助struts2 配置的action路径找不到struts.xml中的这action配置:!-- 更新类别信息--XML code!-- 更新

求助struts2 配置的action路径找不到
struts.xml中的这action配置:
<!-- 更新类别信息-->

XML code
<!-- 更新类别信息-->        <action name="updateSortInfo" class="org.actions.DevSortAction" method="updateSortInfo">            <result name="success">/jsp/sort/showSorts.jsp</result>        </action>

action类中的这个方法:
Java code
public String updateSortInfo(){        System.out.println("aa");        if(sortServices.updateSort(this.devSort)){            return this.SUCCESS;        }        this.request.setAttribute("errorMsg", "数据库连接失败或者该名称已经存在");        return this.ERROR;    } 

jsp页面中的form表单:
HTML code
<FORM action="updateSortInfo.action" method="get" name="myform">里面省略了内容,里面有个提交按钮</FORM>


报错的信息是:
严重: Could not find action or result
No result defined for action org.actions.DevSortAction and result input - action - file:/D:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/devManage/WEB-INF/classes/struts.xml:119:91

我的代码中的aa没有打印出来,说明没有进这个方法。可是这个action中我我还写了其他8,9个方法,都一直没问题。今天写这个方法的时候突然进不来了,真是奇怪。

[解决办法]
探讨
No result defined for action org.actions.DevSortAction and result input

[解决办法]
错误信息是你没有定义<result name="input"></result>也就是出错了,你可以设断点调试一下,看有没有执行到该方法。
[解决办法]
探讨

发现配置input后,点击提交,没进方法,直接跳到input对应的页面。。。
XML code

<!-- 更新类别信息-->
<action name="updateSortInfo" class="org.actions.DevSortAction" method="updateSortInfo">
<result name="success">/……

热点排行