问答详情
源自:3-10 response对象

为什么这样发布到服务器在网页打开报错

<%@ page language="java" import="java.util.*,java.io.*" contentType="text/html; charset=utf-8"%>

<%

 response.setCharacterEncoding("text/html;charset=utf-8");

 out.println("<h1>response内置对象</h1>");

 out.println("<hr>");

 PrintWriter pw=response.getWriter();

 pw.println("大家好,我时PW的对象PW");

 

 

%>


提问者:慕仰4084179 2016-09-05 16:45

个回答

  • 慕粉3276833
    2016-09-23 12:42:00

    把 response.setCharacterEncoding("text/html;charset=utf-8");改成response.setContentType("text/html;character=utf-8");

  • 慕粉3309523
    2016-09-05 21:03:39

    把 response.setCharacterEncoding("text/html;charset=utf-8");改成 request.setCharacterEncoding("utf-8");就行了。