使用ActionRedirect 在action里实现重定向

	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 
		ActionRedirect redirect = new ActionRedirect(mapping.findForward("doRedirect"));
		redirect.addParameter("param1","value1");// 
		redirect.addParameter("param2","2"); 
		redirect.addParameter("param3","3.0"); 
		/**
		 * 或者下一种方式
		 */
		redirect = new ActionRedirect();
		redirect.addParameter("param1","value1");// 
		redirect.addParameter("param2","2"); 
		redirect.addParameter("param3","3.0");
		String url = "";
		redirect.setPath(url);
		return redirect; 
		} 

注意是重定向 不是转发.

你可能感兴趣的:(actionredirect)