'How can I get the size value of the page with pathvariable?

There are 20 data in my database. How can I get the first 5 data in my database with the input I will enter from the index.html page (for example, size = 5)

@GetMapping("/paging/{size}") 
public String getPaging(@PathVariable(name = "size") int size, Model model) {

        Pageable pageable = PageRequest.of(0,size);
        Page<Teacher> entities = teacherRepository.findAll(pageable);

        //model.addAttribute("getSizeKey", entities);
        int sizee = 0;
        model.addAttribute("getSizeKey",sizee);
        return "size";
    }


 </form>
      <table class="mt-4">
        <tr>
          <td>
            <input class="form-control w-25" type="text" th:text="${size}">
          </td>
          <td>
               <a href="/paging/{size}" type="submit" class="btn btn-light" target="_blank">
                get to size
               </a>
          </td>
        </tr>
      </table>

index.html

enter image description here

I typed "5" in the inputtext and hit the "get to size" button. I expect a result like "paging/5" in the URL, but it doesn't happen. What can I do.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source