struts2跳转时找不到action里面的方法
struts.xml<packagename="fit"extends="struts-default"><actionname="*"class="com.struts...
struts.xml
<package name="fit" extends="struts-default">
<action name="*" class="com.struts2.fit.action.FitActionHander" method="{1}" >
<param name="validate">false</param>
<result>SYCX011.jsp</result>
<result name="selectAllFit" type="chain">query</result>
</action>
</package>
action
//查询操作
public String query(){
LscpCommonRange range = new LscpCommonRange();
try{
range.setRangeName(text.trim());
range.setPageSize(2);
range.setPageCode(page.getPageCode());
range.setDelFlag("0");
range = getLoginService().getranges(range);
page.setLineCount(range.getLineCount());
rangeList = range.getList();
}catch(Exception e){
e.printStackTrace();
}
return SUCCESS;
}
//更新数据
public String updateRangeById(LscpCommonRange range){
try {
getLoginService().updateById(range);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "selectAllFit";
}
页面中跳转部分
<s:iterator value="rangeList" status="range">
<tr class="contr">
<td width="26" style="border:none;"><input name="range.rangeId" type="checkbox" value='<s:property value="rangeId"/>' /></td>
<td><s:property value="#range.index"/></td>
<td><a href='<s:url action="updateRangeById.action"><s:param name="range.rangeId" value='<s:property value="rangeId"/>' /></s:url>'><s:property value="rangeName"/></a></td></tr>
</s:iterator>
错误异常
ERROR - Servlet.service() for servlet default threw exception
java.lang.NoSuchMethodException: com.struts2.fit.action.FitActionHander.updateRangeById() 展开
<package name="fit" extends="struts-default">
<action name="*" class="com.struts2.fit.action.FitActionHander" method="{1}" >
<param name="validate">false</param>
<result>SYCX011.jsp</result>
<result name="selectAllFit" type="chain">query</result>
</action>
</package>
action
//查询操作
public String query(){
LscpCommonRange range = new LscpCommonRange();
try{
range.setRangeName(text.trim());
range.setPageSize(2);
range.setPageCode(page.getPageCode());
range.setDelFlag("0");
range = getLoginService().getranges(range);
page.setLineCount(range.getLineCount());
rangeList = range.getList();
}catch(Exception e){
e.printStackTrace();
}
return SUCCESS;
}
//更新数据
public String updateRangeById(LscpCommonRange range){
try {
getLoginService().updateById(range);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "selectAllFit";
}
页面中跳转部分
<s:iterator value="rangeList" status="range">
<tr class="contr">
<td width="26" style="border:none;"><input name="range.rangeId" type="checkbox" value='<s:property value="rangeId"/>' /></td>
<td><s:property value="#range.index"/></td>
<td><a href='<s:url action="updateRangeById.action"><s:param name="range.rangeId" value='<s:property value="rangeId"/>' /></s:url>'><s:property value="rangeName"/></a></td></tr>
</s:iterator>
错误异常
ERROR - Servlet.service() for servlet default threw exception
java.lang.NoSuchMethodException: com.struts2.fit.action.FitActionHander.updateRangeById() 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询