Getting a Request Parameter in a JSP Page

In a GET request, the request parameters are taken from the query string . For example, the URL contains two request parameters – param1and param2. In a POST request, the request parameters are taken from both query string and the posted data which is encoded in the body of the request.
<%= request.getParameter("name") %>
    if (request.getParameter("name") == null) {
        out.println("Please enter your name.");
    } else {
        out.println("Hi, "+request.getParameter(i)+"...");
If the page was accessed with the URL:
the resulting output would be: 
If name is not specified on the query string, the output would be: 



Anonymous said...
This comment has been removed by a blog administrator.
Web Hosting Services said...

Your blog has given me that thing which I never expect to get from all over the websites. Nice post guys!

Post a Comment