02---jsp内置对象07(out对象)

来源:互联网 发布:中国乡村 萧公权知乎 编辑:程序博客网 时间:2024/06/11 18:37

out是javax.servlet.jsp.JspWriter接口的实例,主要功能就是用来输出,但是输出很少用他,而是用
 表达式<%=%>
out 对象定义的方法:
 public int getBufferSize();
 public int getRemaining();

使用<%=%>比使用out.println()方便所以很少使用out;
 <%@ page contentType="text/html" pageEncoding="gbk"%>
 <html>
 <head><title>这是测试</title></head>
 <body>
  <%
   int buffer=out.getBufferSize();//得到缓存的大小
   int avaliable=out.getRemaining();//得到可用资源
   int use=buffer-avaliable;
  %>
  <h3>缓存大小:<%=buffer%></h3> 
  <h3>可用缓冲区大小:<%=avaliable%></h3>
  <h3>已用的缓冲区大小:<%=use%></h3> 
 </body>
 </html>