jsp九大内置对象之response对象

来源:互联网 发布:python app 编辑:程序博客网 时间:2024/06/05 05:42
response对象
    response对象包含了响应客户请求的有关信息,但在JSP中很少直接用到它。它是HttpServletResponse类的实例。
    response对象具有页面作用域,即访问一个页面时,该页面内的response对象只能对这次访问有效,其它页面的response对象对当前页面无效。
方 法 说 明
1 String getCharacterEncoding() 返回响应用的是何种字符编码
2 ServletOutputStream getOutputStream() 返回响应的一个二进制输出流
3 PrintWriter getWriter() 返回可以向客户端输出字符的一个对象
4 void setContentLength(int len) 设置响应头长度
5 void setContentType(String type) 设置响应的MIME类型
6 sendRedirect(java.lang.String location) 重新定向客户端的请求
0 0
原创粉丝点击