title: Getting User details using servlet
body: <p>I'm trying to retrieve the username of user who recently logged in. I used <code>.getRemoteUser()</code> method to read the username. But it was not displaying the user infromation.</p>
  
  <p>my code is :</p>
  
  <pre><code>response.setContentType("text/plain");
  PrintWriter out= response.getWriter();
  // Some introductory HTML...
  String remoteUser = request.getRemoteUser();
  // See if the client is allowed
  if(remoteUser == null) {
      out.println("Welcome");
  } else {
      out.println("Welcome " + remoteUser + "!");
   }
  </code></pre>
  
  <p>I don't know why it was not giving the correct result. It always produces the result "Welcome". Which  means <strong>request.getRemoteUser()==null</strong>. Please anyone tell me how to retrieve the remote user information. Thanks in advance....</p>