JSP out Object

JSP out Object

JSP out  object is instance of javax.servlet.jsp.JspWriter. it is used for writing content to the client (browser) response. This is one of the most used JSP implicit object and thats why we have JSP Expression to easily invoke out.print() method.

In simple words out implicit object is used to write content to the client response.

Example of out implicit object

In this example we are simply displaying message on browser

index.jsp


<html>  
<body>  
<% out.print("Hello Jsp"); %>
</body>  
</html>  

Output

Screenshot (14)

 

Another example of out implicit object

index.jsp


<html>  
<body>  
<form action="first.jsp">
<input type="text" name="name" /><br>
<input type="submit" value="Click"/>
</form>
</body>  
</html>  
Screenshot (25)

first.jsp


<html>  
<body>  
<% out.print(request.getParameter("name")); %>  
</body>  
</html>  

Screenshot (24)

One thought on “JSP out Object

Leave a comment