struts1 中不能跳转,不抱任何错误,怎么回事?

if(Validator.isNotNull(upma.getBelongspec())&&upma.getBelongspec()!=0){
request.setAttribute("location",request.getContextPath()+"/manage/specAuttr.do?method=selartList&spcId="+Integer.valueOf(upma.getBelongspec()));
}else {
String matyId = request.getSession().getAttribute("dumaId").toString();
request.setAttribute("location",request.getContextPath()+"/manage/maInfoByType.do?cid=79&hr=9&matyid="+Integer.valueOf(matyId));
}
return mapping.findForward("ok");
这是第一个Action中的代码,OK是跳到提示信息页面的,我要跳到else里面的那个Action, 就是下面这个
return mapping.findForward("view");
struts-config.xml 中的action是这样:
<action path="/manage/maInfoByType" scope="request" parameter="method"
attribute="searForm" name="searForm"
type="com.chinaclick.john.maInfo.action.searMaInfoAction">
<forward name="view" path="/back/maInfo/maInfoview.jsp"></forward>
<forward name="error" path="/error.jsp"></forward>
</action>
不报任何错误,就是不跳转到我想要去的那个maInfoview.jsp页面,/manage/maInfoByType这个Action是没问题的,我在其他地方用到都能跳转,真心不知道原因了,急求!

这种问题推荐你进行调试模式,看看程序执行是不是按你预期的进行的。

简单的调试的话,你可以在return mapping.findForward("view");的条件入口处加上或者外层入口加上System.out.println()输出信息,看有没有执行到,通过这种方法定位错误,定位问题后在思考解决。追问

调试过,没问题, 走到return mapping.findForward("view"); 这一步了,view在struts-config.xml中指向一个页面,不过程序运行时就不跳转
这个ACtion指向的一个列表页,其他地方调用都跳转了,这上面那个方法时不跳转

温馨提示:内容为网友见解,仅供参考
第1个回答  2012-11-29
return mapping.findForward("ok");
这是第一个Action中的代码,OK是跳到提示信息页面的,我要跳到else里面的那个Action, 就是下面这个
return mapping.findForward("view");

这怎么同时有两个return啊 表示不理解啊
相似回答