CodesJava

Easy learning with example program codes

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.</h3>
	</body>
</html>

web.xml

<web-app>
 
  <welcome-file-list>
          <welcome-file>login.jsp</welcome-file>
  </welcome-file-list>	
 
</web-app>

Output:

jsp example 20 login
 
Enter Username: jai
jsp example 20 value
 
Click on login button.
jsp example 20 display
 
Download this example.
 
Next Topic: JSP config implicit object with example.
Previous Topic: JSP request implicit Object with example.

Related Topics:

JSP implicit objects with example.
JSP out implicit object with example.
JSP request implicit Object with example.
JSP response implicit object with example.
JSP config implicit object with example.
JSP application implicit object with example.
JSP session implicit object with example.
JSP pageContext implicit object with example.
JSP page implicit object with example.
JSP exception implicit object with example.

 

Sign Up/ Sign In
Ask a Question


Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at hr@codesjava.com.

Development

We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on hr@codesjava.com.

Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki