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: 


Getting the Client's Address in a Servlet

public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    // Get client's IP address
    String addr = req.getRemoteAddr(); //

    // Get client's hostname
    String host = req.getRemoteHost(); //