title: how to show a progress bar in the jsp page representing the execution of a java servlet
body: <p>I came across my posts which answer this question.But i am not able get an idea of how i can implement in my program.My requirement is as follows.</p>
  
  <p>from a jsp page i call a servlet using ajax call:</p>
  
  <pre><code>$(document).on('click' , '#gettopevents' , function(event) {
  
  
              var field = $("input[name = 'field']").val(); 
  
              if(field === "")
              {
                  $('#responsemsg').html("enter a field");
              }
              else
              {
                  var dataform = { 'field' : field };
  
                  $.ajax({
                          url : 'GetAllLogs',
                          type : 'POST' , 
                          data : dataform , 
                          success : function(response) {
                              $('#displaylist').load('listgeneration.jsp');
                          },
                          error : function(){
                              alert("error");
                          }
                  });
              }
  
              event.preventDefault();
      });
  </code></pre>
  
  <p>The servlet execution is an intence process and it takes some time.So i need to show a progress bar to the user regarding the execution status of servlet.
  More specifically i need it to be as.</p>
  
  <pre><code>@WebServlet("/GetAllLogs")
  public class GetAllLogs extends HttpServlet
  {
      public void doGet(HttpServletRequest request , HttpServletResponse response) throws ServletException , IOException  
      {
            PrintWriter obj = response.getWriter();
            obj.print(10);
            // at this point i need to set the progress bar value to 10%
  
            ....
            ....
  
            obj.print(40);
            // at this point i need to change the progress bar value to 40%
           .....
           .....
  
            obj.print(100);
             //at this point i neet to change the progress bar value to 100%
      }
  }
  </code></pre>
  
  <p>basically i need to update the status bar for ever print value in the servlet.Is this approach possible and how can i do it.
  Thanks in advance</p>