Programming Tutorials

The Out Object in JSP

By: Sathya Narayana in JSP Tutorials on 2010-10-24  

In JSP, the out object is an instance of the JspWriter class, which provides a way to send output to the client browser.

The out object is automatically created by the JSP container and is available for use in scriptlets, expressions, and custom tags. It can be used to write output directly to the client browser, and can also be used in combination with other JSP objects to dynamically generate HTML, XML, or other types of content.

Some of the commonly used methods of the out object include:

  • print() and println(): used to write text to the response output stream.
  • flush(): used to clear the output stream and send any buffered content to the client.
  • clear(): used to clear any content that has been written to the output stream, but has not yet been sent to the client.

Here is an example of using the out object in a JSP page:

<html>
<head>
    <title>Example</title>
</head>
<body>
    <%
        out.print("Hello, World!");
    %>
</body>
</html>

In this example, the out object is used to write the string "Hello, World!" to the client browser.






Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in JSP )

Latest Articles (in JSP)