In this tutorial you will learn about the JSP response implicit Object and its application with practical example.
JSP response implicit Object
This is the instance of HttpServletResponse object and created by the web container for each jsp request.
A response contain data passed between a server and the client and All Responses implement the ServletResponse interface. This interface defines methods that allow you to:
# Retrieve an output stream to use and send data to the client.
# Indicate the content type(for example text/html).
# Indicate whether to buffer output with the setBufferSize(int) method.
# Set localization information such as locale and character encoding.
Example:
//Index.jsp
1 2 3 4 5 6 7 8 9 10 11 |
<%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <body> <form action="Welcome.jsp"> <pre> <input type="submit" value="Click"><br/> </pre> </form> </body> </html> |
Output
Welcome.jsp: This will call when you will click on “Click” Button.
1 2 3 4 5 6 7 |
<%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <body> <% response.sendRedirect("http://www.w3adda.com");%> </body> </html> |
Output: