JSP response implicit object
JSP response object is an instance of javax.servlet.http.HttpServletResponse. It is mainly used to modify the response.
Example:
login.jsp
<html>
<head>
<title>login</title>
</head>
<body>
<form action="welcome.jsp">
<input type="text" name="userName" />
<input type="submit" value="login"/>
</form>
</body>
</html>
|
welcome.jsp
<html>
<head>
<title>response implicit object example</title>
</head>
<body>
<%
String userName=request.getParameter("userName");
if(userName.equals("jai")){
response.sendRedirect("home.jsp");
}else{
out.print("Wrong username.");
}
%>
</body>
</html>
|
home.jsp
<html>
<head>
<title>home</title>
</head>
<body>
<h3>This is user's home page.
|