Pin It

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.



Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Related Posts Plugin for WordPress, Blogger...

Post your related queries below ...

comments powered by Disqus
Powered by Blogger.
 
© 2012 Learn Java by Examples Template by Hubber Spot