getParameter() – Passing data from client to JSP
The familiarity of the getParameter() method in getting data, especially form data, from a client HTML page to a JSP page is dealt with here. The request.getParameter() is being used here to retrieve form data from client side.
Steps to be followed
1) First, a html page exGetParameter.html accepts data from the client. The client enters text in the space provided and clicks on ‘Submit’.
2) Immediately the getparam.jsp page gets called, it being mentioned in the action tag.
3) This JSP page fetches the data using getParameter() method and displays the same to the user.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
Note: Entire application has been developed and tested on NetBeans IDE 8.1.
Page to accept client data : exGetParameter.html page
Page to fetch client data : getparam.jsp
Client Data : exGetParameter.html
After clicking on ‘Submit’ the following screen appears.
Fetched Data from Client : getparam.jsp