Skip to main content

JSP Response implicit Object

The response object is a type of HttpServletResponse.

Which is present in javax.servlet.http.HttpServletResponse

Response object used to Redirect page, Set HTTP status code and add cookies into Response.

container create response object for every Request.

Method of response object.

syntax:

1
2
3
<%
    response.sendRedirect("https://www.google.co.in");
%>

i.e

ResponseObject.JSP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<%@ page language="java" %>
<html>
<head>
<title>Insert title here</title>
</head>
<body>
 
<%
 
   response.sendRedirect("https://www.google.co.in");
 
%>
 
</body>
</html>

Output: