title: HTML page not displaying when called from backend using springboot and thymeleaf
body: <p>I have this controller file code. This accepts data from the frontend in the form of @RequestParams. Once I have received the values, I am trying to call another html file called cart .html by adding an attribute using the addAttribute function in models.</p>
  <pre><code>@GetMapping(&quot;/cart&quot;)
      @ResponseBody
      public String getIfBorrowedBook(Model model, @RequestParam List&lt;Integer&gt; bookIds) {
          System.out.println(bookIds);
  //      if(ifBorrowed.equals(&quot;on&quot;)) {
  //          Books book = booksService.findById(bookId);
  //          book.setIfBorrowed(true);
              
  //          booksService.save(book); 
          List&lt;Books&gt; booksInCart = new ArrayList&lt;&gt;();
          for(Integer id:bookIds) {
              
          booksInCart.add(booksService.findById(id));
          
              
          }
          System.out.println(booksInCart);
      model.addAttribute(&quot;booksInCart&quot;, booksInCart);
  
          return &quot;cart&quot;;  
          
      }
  </code></pre>
  <p>This is my cart.html</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns:th=&quot;http://www.thymeleaf.org&quot;&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;ISO-8859-1&quot;&gt;
      &lt;title&gt;List Books&lt;/title&gt;
      &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/webjars/bootstrap/css/bootstrap.min.css&quot; /&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;/webjars/jquery/jquery.min.js&quot;&gt;&lt;/script&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;/webjars/bootstrap/js/bootstrap.min.js&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div class=&quot;container text-center&quot;&gt;
      &lt;h1&gt;
          Cart
      &lt;/h1&gt;
       
      &lt;div&gt;
     
          &lt;table class=&quot;table table-striped table-bordered&quot;&gt;
              &lt;thead class=&quot;thead-dark&quot;&gt;
                  &lt;tr&gt;
               
                      &lt;th&gt;Title&lt;/th&gt;
                      &lt;th&gt;Genre&lt;/th&gt;
                      &lt;th&gt;Author&lt;/th&gt;
                      &lt;th&gt;Edition&lt;/th&gt;
                      
                  &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
                  &lt;tr th:each=&quot;book: ${booksInCart}&quot;&gt;
                     
                      &lt;td th:text=&quot;${book.title}&quot;&gt;Title&lt;/td&gt;
                      &lt;td th:text=&quot;${book.genre}&quot;&gt;Genre&lt;/td&gt;
                      &lt;td th:text=&quot;${book.author}&quot;&gt;Author&lt;/td&gt;
                      &lt;td th:text=&quot;${book.edition}&quot;&gt;Edition&lt;/td&gt;
                      &lt;td&gt;
                          
                          
                          
                          
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/tbody&gt;
               &lt;div&gt;
                 
              &lt;/div&gt;
          &lt;/table&gt;
         
      &lt;/div&gt;
  
  &lt;/div&gt;
      
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>This is the show_filtered books file that has a form which is submitted to the controller get request once a buttom is clicked.</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns:th=&quot;http://www.thymeleaf.org&quot;&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;ISO-8859-1&quot;&gt;
      &lt;title&gt;List Books&lt;/title&gt;
      &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/webjars/bootstrap/css/bootstrap.min.css&quot; /&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;/webjars/jquery/jquery.min.js&quot;&gt;&lt;/script&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;/webjars/bootstrap/js/bootstrap.min.js&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div class=&quot;container text-center&quot;&gt;
      &lt;div&gt;
          &lt;h1&gt;
          &lt;div th:text=&quot;'Books on '+${filteredBooks[0].genre}&quot;&gt;&lt;/div&gt;
          &lt;/h1&gt;
      &lt;/div&gt;
       
      &lt;div&gt;
      &lt;form th:action=&quot;@{/cart}&quot;&gt;
          &lt;table class=&quot;table table-striped table-bordered&quot;&gt;
              &lt;thead class=&quot;thead-dark&quot;&gt;
                  &lt;tr&gt;
               
                      &lt;th&gt;Title&lt;/th&gt;
                      &lt;th&gt;Genre&lt;/th&gt;
                      &lt;th&gt;Author&lt;/th&gt;
                      &lt;th&gt;Edition&lt;/th&gt;
                      &lt;th&gt;Borrow Book&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
                  &lt;tr th:each=&quot;book: ${filteredBooks}&quot;&gt;
                     
                      &lt;td th:text=&quot;${book.title}&quot;&gt;Title&lt;/td&gt;
                      &lt;td th:text=&quot;${book.genre}&quot;&gt;Genre&lt;/td&gt;
                      &lt;td th:text=&quot;${book.author}&quot;&gt;Author&lt;/td&gt;
                      &lt;td th:text=&quot;${book.edition}&quot;&gt;Edition&lt;/td&gt;
                      &lt;td&gt;
                          
                          &lt;input type=&quot;checkbox&quot; name=&quot;bookIds&quot; th:value=&quot;${book.bookId}&quot; th:checked=&quot;${book.ifBorrowed}&quot;/&gt;
                          
                          
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/tbody&gt;
               &lt;div&gt;
                 &lt;a href=&quot;cart&quot;&gt;
                  &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Add to Cart&lt;/button&gt;
                  &lt;/a&gt;
              &lt;/div&gt;
          &lt;/table&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
      
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>But when I try to return the cart string at the end of getIfBorrowed() method, I am not getting the cart.html file. I am just getting a string that says cart on the webpage. This cart.html file is location in src/main/resources/templates. Therefore spring mvc should automatically be able to recognize the file but it does not do so.</p>