JSP response object

JSP response object

JSP response implicit object is instance of javax.servlet.http.HttpServletResponse.

The instance of HttpServletResponse is created by the web container for each jsp request.It is basically used to sent response to the client(browser) after processing the request.

It is also used to set content type, header information in response, adding cookies to response and redirecting the request to other resource.

 

Example of response implicit object

index.html


<html>

<body>
<form action="first.jsp">   
<input type="submit" value="Open Facebook"><br/>  
</form>  
</body>
</html>

first.jsp


<%

response.sendRedirect("https://www.facebook.com");  
%> 

One thought on “JSP response object

Leave a comment