title: Display loop response in loader modal while return the intermediate page in java
body: <pre><code>@RequestMapping(value = "/getMusterRollDateBasedNew", method = RequestMethod.GET)
  public ModelAndView getMusterRollDateBasedNew(EmployeeReportsModel employeeReportsModel) {
      ModelAndView mv = new ModelAndView();
      String tablePrefix = "at_hr_logs_";
      String loopresponse = null;
      try {
          String fromdate = employeeReportsModel.getReportFromDt();
          String todate = employeeReportsModel.getReportToDt();
          Date date1 = new SimpleDateFormat("yyyy-MM-dd").parse(fromdate);
          Date date2 = new SimpleDateFormat("yyyy-MM-dd").parse(todate);
          SimpleDateFormat sdfDestination = new SimpleDateFormat("yyyy-MM-dd");
          String fromdate1 = sdfDestination.format(date1);
          String todate1 = sdfDestination.format(date2);
          employeeReportsModel.setReportFromDt(fromdate1);
          employeeReportsModel.setReportToDt(todate1);
          // get dates between two dates
  
          List&lt;EmployeeReportsModel&gt; datesList = employeeReportsMapper.getDatesBetweenTwoDates(employeeReportsModel);
          mv.addObject("datesList", datesList);
  
          List&lt;EmployeeReportsModel&gt; dayAndMonth = employeeReportsMapper.getDayandMonthBetweenTwoDates(employeeReportsModel);
          mv.addObject("dayAndMonth", dayAndMonth);
  
          ArrayList&lt;Integer&gt; datesList2 = new ArrayList&lt;Integer&gt;();
  
          int step;
          for (step = datesList.size(); step &lt;= 31; step++) {
              datesList2.add(step + 1);
          }
          mv.addObject("datesList2", datesList2);
  
          List&lt;EmployeeReportsModel&gt; empList = employeeReportsMapper.getMusterSheetDateEmpList(employeeReportsModel);
          mv.addObject("empList", empList);
          int loopCounter = 0;
          for (EmployeeReportsModel x : empList) {
  
              loopCounter += 1;
              //System.out.println("loopCounter is..." + loopCounter);
              employeeReportsModel.setEmpCode(x.getEmpCode());
              employeeReportsModel.setEmpName(x.getEmpName());
              employeeReportsModel.setDepartmentId(x.getDepartmentId());
              employeeReportsModel.setCompanyId(x.getCompanyId());
  
              int insert = employeeReportsMapper.setEmployeeCodes(employeeReportsModel);          
  
                loopresponse =  loopCounter + "/" + empList.size();
               System.out.println("loopresponse is..." + loopresponse);
  
              int counter = 0;
              for (EmployeeReportsModel y : datesList) {
  
                  counter += 1;
                  employeeReportsModel.setReportFromDt(y.getReportFromDt());
                  String[] parts = y.getReportFromDt().split("-");
                  String part1 = parts[0]; // 004
                  String part2 = parts[1]; // 034556
                  String part3 = parts[2];
  
                  String tableName = tablePrefix + part1 + '_' + part2;
                  employeeReportsModel.setDynamicTableName(tableName);
                  // define two strings
                  String columnFirstName = "day";
                  Integer columnSecondName = counter;
                  // concatenate the strings
                  String columnName = columnFirstName + columnSecondName;
  
                  employeeReportsModel.setColumnName(columnName);
                  EmployeeReportsModel attdLogs = employeeReportsMapper.getLogTimings(employeeReportsModel);
                  employeeReportsModel.setDay1(attdLogs.getDay1());
                  employeeReportsMapper.updateEmployeeLogs(employeeReportsModel);
  
              }
          }
          List&lt;EmployeeReportsModel&gt; allLogs = employeeReportsMapper.getMusterSheetAllLogs(employeeReportsModel);
          mv.addObject("allLogs", allLogs);
  
          employeeReportsMapper.truncateTable(employeeReportsModel);
          // employeeReportsMapper.dynamicCreationofTablesMuster();
  
      } catch (Exception e) {
          e.printStackTrace();
          employeeReportsMapper.truncateTable(employeeReportsModel);
      }
      mv.setViewName("/" + moduleName + "/employeeMusterRollBasedOnDateInterNew");
      return mv;
  
  }
  </code></pre>
  
  <p>Now we need get  <strong>loopresponse</strong> in browser lodar modal. for every loop we get the response in between loop execution.can I set <strong>loopresponse</strong> in existing below modal</p>
  
  <p>here loopresponse = numOfEmp/loopCount.</p>
  
  <p>so need set as below</p>
  
  <p>example:loopresponse 1/15,2/15,3/15,4/15,5/15,6/15,7/15,8/15,9/15,10/15,11/15,12/15,13/15,14/15,15/15.</p>
  
  <p>we need to set in below lodar modal </p>
  
  <pre><code> &lt;div id="loadarModal" class="modal fade" tabindex="-1"
                  style="padding-left: 200px; padding-top: 150px;"&gt;
                  &lt;div class="modal-dialog modal-sm"&gt;
                      &lt;div class="modal-body"&gt;
                          &lt;img
                              src="/&lt;s:message code="projectName"&gt;&lt;/s:message&gt;/resources/images/ajax-loader.gif" /&gt;
                          &lt;font style="color: white;"&gt;loading...Please Wait&lt;/font&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div id="loadarDiv" hidden&gt;
                  &lt;div align="center"&gt;
                      &lt;img
                          src="/&lt;s:message code="projectName"&gt;&lt;/s:message&gt;/resources/images/ajax-loader(Black).gif" /&gt;
                      &lt;font&gt;loading...Please Wait&lt;/font&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  </code></pre>