Could not find action or result 异常解决

Could not find action or result 错误解决最近在使用的struts2时 出现了这个错误啊,控制台提示Could not

Could not find action or result 错误解决

最近在使用的struts2时 出现了这个错误啊,控制台提示Could not find action or result,分享解决办法。

struts.xml代码

<package name="report" namespace="/report" extends="struts-default"><action name="report_*" method="{1}"><result name="getFhsLinesSuccess">../report/StormlinesInfo_500kv.jsp</result><result name="getFhsLinesError" >../error.jsp</result><action name="report_*" method="{1}"><result name="getFhsStationSuccess">/report/TransStationInfo_500kv.jsp</result><result name="getFhsStationError" >../error.jsp</result><action name="report_*" method="{1}"><result name="getLossConditionSuccess">/report/LossCondition.jsp</result><result name="getLossConditionError" >../error.jsp</result></action></package>

?可能错误原因1:

一个package下对应了多个action。导致只有最后一个action配置可识别,其他的action配置失效,抛此异常。

解决方法:

在一个action标签中,配置所有该action下的result,避免重复

?

页面jsp代码:

<form action="report/report_getFhsLines" method="post" id="stormForm">线路情况<select id="line" name="lineValue"><option value="500kvLines">500千伏</option><option value="220kvLines">220千伏</option><option value="66kvLines">66千伏</option><option value="10kvLines">10千伏</option></select><input type="hidden" name="storm.areaCode" value="<%=areaCode%>"><input type="submit" value="查询"></form>

?可能错误原因2:

在页面action提交路径中找不到对应的action

解决方法:

将action地址修改为:

<form action="${pageContext.request.contextPath}/report/report_getFhsLines" method="post" id="stormForm">

?说明:

代码” ${pageContext.request.contextPath}”的作用是取出部署的应用程序名,这样不管如何部署,所用路径都是正确的。?