日期:2014-05-18  浏览次数:20717 次

struts 的action里面,怎么redirect一个 动态生成的URL呢
我在action里面动态拼接了一个URL,怎么能够迁移上去呢

------解决方案--------------------
public ActionForward execute(..) {
//perform what you need to

//Then redirect
response.sendRedirect( "http://www.xyz.com ");

//pass null to struts.
return null;

}
看看行不
------解决方案--------------------
请参看struts的org.apache.struts.action.ActionForward


例:return new ActionForward( "/jsp/GGMan/FPageForm.do ", "/jsp/GGMan/FPageForm.do ",true);
------解决方案--------------------
直接写return new ActionForward( "URL ");
其中URL是你期望的下个一页面,例如/app/list.do, /app/input.jsp等。
楼上办法应该就是一个redirect,似乎会把request上下文中保存的属性丢掉。


------解决方案--------------------
最好不要这么写
写成
ActionForward forward = new ActionForward(xx,xx,xx);
return forward;

这种做法比较好。

======================

或者直接
response.setRedirect(../xx.do?param=xxx)
也可以。


new RedirectingActionForward(url);
的做法很怪异!