Response implicit object is mainly used for send response to the client browser after processing the request.
Suppose a user login with his user id and password, If he enter correct user id and password then it give a success message. In the other hand if he enter incorrect user id and password then it give error message.
<!DOCTYPE html>
<html>
<head>
<title>JSP Session</title>
</head>
<body>
<form action="process.jsp">
<input type="text" placeholder="User id" name="userid"> <br><br>
<input type="text" placeholder="Password" name="password"> <br> <br>
<input type="submit" value="submit"><br>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JSP Session</title>
</head>
<body>
<%
String userid=request.getParameter("userid");
String password=request.getParameter("password");
if(userid.equals("admin") && password.equals("admin123"))
{
response.sendRedirect("success.jsp");
}
else {
response.sendRedirect("error.jsp");
}
%>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>you are Sucessfully logged In</title>
</head>
<body>
<p>Sucess</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Error</title>
</head>
<body>
<p>Error</p>
</body>
</html>
If you put worng userid and password then the output is.