Free Data Structures and Algorithms Course









Subscribe below and get all best seller courses for free !!!










OR



Subscribe to all free courses

How to use param implicit object in a JSP page ?.

A simple web application demonstrating how to use param implicit object in a jsp.

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.



 
© 2021 Learn Java by Examples Template by Hubberspot