response.sendRedirect使用的是get方式提交,如果想要post,看下面
public static void redirect(String url, Map<String,String> params, HttpServletResponse response) throws IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"); out.println("<HTML>"); out.println(" <HEAD><TITLE>sender</TITLE></HEAD>"); out.println(" <BODY>"); out.println("<form name=\"submitForm\" action=\""+url+"\" method=\"post\">"); Iterator<String> it=params.keySet().iterator(); while(it.hasNext()){ String key=it.next(); out.println("<input type=\"hidden\" name=\""+key+"\" value=\""+params.get(key)+"\"/>"); } out.println("</from>"); out.println("<script>window.document.submitForm.submit();</script>"); out.println(" </BODY>"); out.println("</HTML>"); out.flush(); out.close(); }