JSP out

In JSP, out is an implicit object that is associated with the response object. This object is used to write content to the output stream.

Methods of JSP out

Following are some important methods of JSP out: -

           Method

                 Description

void print()

This is one of the most frequently used method. It prints the statement.

void clear()

This method is used to remove the content of buffer.

boolean isAutoFlush()

This method specifies whether the buffer is flushed or not.

int getBufferSize()

This method returns the size of buffer in bytes.

int getRemaining()

This method returns the unused size of buffer in bytes.

Example of JSP out

This example shows the functionality of all the above methods on JSP out object.

index.jsp

<html>
<head>
<title>Tutorial and Example</title>
</head>
<body>
<%
String s="Tutorial and Example";
out.println("Learn JSP");
out.clear();
Boolean b=out.isAutoFlush() ;
out.println("<br><h2 align=center>IsAutoFlush:"+b);
out.println("<br>Website:"+s);
int i1=out.getBufferSize();
out.println("<br>Buffer Size:"+i1);
int i2=out.getRemaining();
out.println("<br>Remaining Size:"+i2+"</h2>");
%>
</body>
</html>
Output: