JSP response

tutorial and example
tutorial and example

Basically, JSP response object is an instance of servlet’s HttpServletResponse interface. It is used to resolve client request.

Response object can be used to perform various functions such as encode URL, add cookies, add headers, send errors, set content type etc.

Example of JSP Response

In this example, user’s password is set in index.jsp file. If the password entered in the form is same then valid.jsp file will execute. If entered password is unmatched then invalid.jsp file will execute.

index.html

index.jsp

Valid.jsp

invalid.jsp

Here, we already set “abcd” as password. So, if the entered password is correct then only the user is valid.

Output:

Here, we already set “abcd” as password. So, if the entered password is correct then only the user is valid.