struts_response的Redirect()方法的使用(重定向)

来源:互联网 发布:淘宝网有多少买家 编辑:程序博客网 时间:2024/06/13 23:34

String url = new String( ("../j_spring_security_check?j_username="
+java.net.URLEncoder.encode(loginName)
+"&j_password="+password).getBytes("UTF-8"),"ISO8859_1");

//你要转向的页面的地址.
HttpServletResponse response = ServletActionContext.getResponse();
response.sendRedirect(url);
//重定向后,别忘了返回null值,而不能再返回return

//mapping.findForward("****");
return null;
//return SUCCESS;