public class ReqeustScope1 extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("GBK"); response.setCharacterEncoding("GBK"); response.setContentType("text/html"); PrintWriter out = response.getWriter(); String sex = "男"; String url = "/servlet/RequestScope2?sex=" + sex; response.sendRedirect(context + url); out.flush(); out.close(); } } public class RequestScope2 extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("GBK"); response.setCharacterEncoding("GBK"); response.setContentType("text/html"); PrintWriter out = response.getWriter(); System.out.println(" =====:" + request.getParameter("sex")); out.flush(); out.close(); } } 在RequestScope2中输出的就不是中文了 这个要怎么解决

Servlet之间重定向传参出现中文乱码要怎么解决???
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-