title: How to get the status after using HttpServletResponse.setStatus
body: <p>I have a Http Upload Servlet (http-post) and a user can upload an XML file along with some form fields. I have put on some validation checks to see if there was a bad request (eg. null value). So I used the following code chunk to perform that.</p>
  
  <pre><code>String myID = request.getParameter("ID");
  if (myID .equalsIgnoreCase("")|| myID ==null)
  response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
  else
  myBean.setMyId(myID );
  </code></pre>
  
  <p>Now that I set the response.setStatus, I wanted to see what response.getStatus would look like, but I did not find any method in the HttpServletResponse class (my response is HttpServletResponse) that could show me the status. I needed to output the status as a field called Server Response as a response to the upload. Please help me with suggestions.</p>