A simple web application demonstrating how to use param implicit object in a jsp.
1. Create a simple jsp page as "param.jsp".
2. Create a simple jsp page by name "display.jsp"
display.jsp page use implicit object called as param to retrieve the form values coming as a post request.
Run param.jsp and enter username and click submit:
On clicking submit the form values passed as username to display.jsp which uses param implicit object to retrieve the value of username as shown below in the fig.
1. Create a simple jsp page as "param.jsp".
<%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <form method="post" action="display.jsp"> <tr> <td>Enter Your Name:</td> <td><input name="username" type="text"></td> </tr> <tr> <td colspan="2"><input type="submit" value="Submit"></td> </tr> </form> </body> </html>
2. Create a simple jsp page by name "display.jsp"
<%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h2>Name entered: ${param.username}</h2> </body> </html>
display.jsp page use implicit object called as param to retrieve the form values coming as a post request.
Run param.jsp and enter username and click submit:
On clicking submit the form values passed as username to display.jsp which uses param implicit object to retrieve the value of username as shown below in the fig.