title: How can I bind an array of data to html table using Spring boot REST apllication and not by Spring MVC
body: <p>I have a Spring Boot REST application, in which one of the REST API sends mail to the respective users.</p>
  <p>I have designed a mailer template in Html and my rest API has data in an array which I am binding to an Html table using  and  tags.</p>
  <p>How can I bind an array of data to Html table using Spring Boot REST application and not by Spring MVC</p>
  <pre><code>1. HTML code
  
      &lt;tr&gt;
                          &lt;td style=&quot;padding: 20px 18px 0; color: #888686; font-size: 15px; font-family: 'Open Sans';&quot;&gt;
                              &lt;table style=&quot;border-collapse: collapse;&quot; width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
                                  &lt;tbody&gt;
                                      &lt;tr&gt;
                                          &lt;th
                                              style=&quot;padding: 8px 20px; border: 1px solid #eeeeee; background: #ffffff; color: #888686; font-size: 15px; font-family: 'Open Sans'; width: 35%;&quot;&gt;
                                              DATE&lt;/th&gt;
                                              &lt;th
                                              style=&quot;padding: 8px 20px; border: 1px solid #eeeeee; background: #ffffff; color: #888686; font-size: 15px; font-family: 'Open Sans'; width: 35%;&quot;&gt;
                                              AVAILABILITY&lt;/th&gt;
                                              &lt;th
                                              style=&quot;padding: 8px 20px; border: 1px solid #eeeeee; background: #ffffff; color: #888686; font-size: 15px; font-family: 'Open Sans'; width: 35%;&quot;&gt;
                                              WORK START TIME&lt;/th&gt;
                                               &lt;th
                                              style=&quot;padding: 8px 20px; border: 1px solid #eeeeee; background: #ffffff; color: #888686; font-size: 15px; font-family: 'Open Sans'; width: 35%;&quot;&gt;
                                              WORK END TIME&lt;/th&gt;
                                               &lt;th
                                              style=&quot;padding: 8px 20px; border: 1px solid #eeeeee; background: #ffffff; color: #888686; font-size: 15px; font-family: 'Open Sans'; width: 35%;&quot;&gt;
                                              BREAK START TIME&lt;/th&gt;
                                               &lt;th
                                              style=&quot;padding: 8px 20px; border: 1px solid #eeeeee; background: #ffffff; color: #888686; font-size: 15px; font-family: 'Open Sans'; width: 35%;&quot;&gt;
                                              BREAK END TIME&lt;/th&gt;
                                      &lt;/tr&gt;
                                      &lt;c:forEach var=&quot;oldList&quot; items=&quot;${scheduleDetailsOld}&quot;&gt;
                                      &lt;tr&gt;
                                          &lt;td style=&quot;padding: 8px 20px; border: 1px solid #eeeeee; background: #ffffff; color: #888686; font-size: 15px; font-family: 'Open Sans'; width: 35%;&quot;&gt;${oldList.day}&lt;/td&gt;
                                          &lt;td style=&quot;padding: 8px 20px; border: 1px solid #eeeeee; background: #ffffff; color: #888686; font-size: 15px; font-family: 'Open Sans'; width: 35%;&quot;&gt;${oldList.availability}&lt;/td&gt;
                                          &lt;td style=&quot;padding: 8px 20px; border: 1px solid #eeeeee; background: #ffffff; color: #888686; font-size: 15px; font-family: 'Open Sans'; width: 35%;&quot;&gt;${oldList.workStartTime}&lt;/td&gt;
                                          &lt;td style=&quot;padding: 8px 20px; border: 1px solid #eeeeee; background: #ffffff; color: #888686; font-size: 15px; font-family: 'Open Sans'; width: 35%;&quot;&gt;${oldList.workEndTime}&lt;/td&gt;
                                          &lt;td style=&quot;padding: 8px 20px; border: 1px solid #eeeeee; background: #ffffff; color: #888686; font-size: 15px; font-family: 'Open Sans'; width: 35%;&quot;&gt;${oldList.breakStartTime}&lt;/td&gt;
                                          &lt;td style=&quot;padding: 8px 20px; border: 1px solid #eeeeee; background: #ffffff; color: #888686; font-size: 15px; font-family: 'Open Sans'; width: 35%;&quot;&gt;${oldList.breakEndTime}&lt;/td&gt;
                                      &lt;/tr&gt;
                                      &lt;/c:forEach&gt;
                                  &lt;/tbody&gt;
                              &lt;/table&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
  
  2.email sender method
  
  public void shiftUpdatedMailForEditor(Staff staff) {
          new Thread(() -&gt; {
              try {
                  Map&lt;String, String&gt; values = new HashMap&lt;&gt;();
                  values.put(&quot;getName&quot;, staff.getName());
                  values.put(&quot;getSubject&quot;, &quot;Work schedule details have been modified.&quot;);
                  mailerService.sendStaffShiftUpdatedForEditorEmail(values, staff.getEmail());
              } catch (PaperTrueException e) {
                  e.printStackTrace();
              }
          }).start();
      }
  
  3. get HTML temlate service
  
      protected void sendStaffShiftUpdatedForEditorEmail(Map&lt;String, String&gt; valuesMap, String receiverEmail)
                  throws PaperTrueJavaException {
              // concerned Editor (receiverEmail)
              System.out.println(&quot;Inside sendStaffShiftUpdatedForEditorEmail&quot;);
              mailer.sendMail(&quot;xyz@gmail.com&quot;, &quot;xyz@gmail.com&quot;, valuesMap.get(&quot;getSubject&quot;),
                      formatHtml(getHTMLBody(HtmlTemplateURL), valuesMap));
          }
  
  4. here is my controller
      
      @PostMapping(&quot;/update-schedule-details&quot;)
                  public ResponseEntity&lt;StatusResponse&gt; updateScheduleDetails(@Valid @RequestBody addScheduleDetailsBody body,
                          Model model) {
                      StatusResponse statusResponse = new StatusResponse();
                      try {
                          util.isStaffLoggedIn(request, response, List.of(StaffRole.EDITOR, StaffRole.HR_MANAGER));
                          Iterator&lt;AddScheduleDetails&gt; iterator = body.getScheduleDetails().iterator();
                          ArrayList&lt;ScheduleDetails&gt; scheduleDetailsNew = new ArrayList&lt;ScheduleDetails&gt;();
                      ArrayList&lt;ScheduleDetails&gt; scheduleDetailsEarlier = new ArrayList&lt;ScheduleDetails&gt;();
                      while (iterator.hasNext()) {
                          AddScheduleDetails addScheduleDetails = (AddScheduleDetails) iterator.next();
                          if (scheduleDetailsService.getShift(new Date(addScheduleDetails.getDay()),
                                  addScheduleDetails.getEditorId())) {
                              addScheduleDetails(addScheduleDetails);
                          } else {
                              scheduleDetailsEarlier = updateScheduleDetails(addScheduleDetails, scheduleDetailsEarlier);
                          }
                          ScheduleDetails scheduleDetails = scheduleDetailsService.get(new Date(addScheduleDetails.getDay()),
                                  addScheduleDetails.getEditorId());
                          scheduleDetailsNew.add(scheduleDetails);
                      }
                      model.addAttribute(&quot;scheduleDetailsOld&quot;, scheduleDetailsEarlier);
                      model.addAttribute(&quot;scheduleDetailsNew&quot;, scheduleDetailsNew);
                          emailSender.shiftUpdatedMailForEditor(util.getLoggedInStaff(request));
                          statusResponse.setStatus(new Status(&quot;Editor Schedule Details Updated Successfully&quot;));
                      } catch (PaperTrueException e) {
                          util.logException(e, LogType.GET_JOBS);
                          statusResponse.setStatus(new Status(e.getCode(), e.getMessage()));
                      }
                      return ResponseEntity.ok(statusResponse);
                  }
  </code></pre>