JSP response implicit object example

In JSP, the response is an implicit object of type HttpServletResponse. The instance of HttpServletResponse is created by the web container for each JSP request.

It can be used to add or manipulate responses such as redirect response to another resource, send error, etc.
All JSP Examples at JSP Source Code Examples

Example of response implicit object

Let's see the example of response implicit object where we are redirecting the response to Google.

index.html

<form action="welcome.jsp">  
   <input type="text" name="uname">  
   <input type="submit" value="go"><br/>  
</form>  

welcome.jsp

<%   
   response.sendRedirect("http://www.google.com");  
%>  
All JSP Examples at JSP Source Code Examples

Comments