spring boot and html
How can I send an item from spring boot code to an html script using getmapping? i have some methods here, but on the html, all the items are hardcoded because im not sure how to get these methods on html
@GetMapping(path = "/items")
public @ResponseBody List<Items> listItems()
{
return itemsRepository.findAll();
}
@GetMapping(path = "/items/{id}")
public @ResponseBody Optional<Items> findItems(@PathVariable("id") Integer id)
{
return itemsRepository.findById(id);
}
@PostMapping(path = "/items")
public @ResponseBody void addItem(@RequestBody Items item)
{
itemsRepository.save(item);
}
@DeleteMapping(path = "/items/{id}")
public @ResponseBody void deleteItem(@RequestParam("id") int id)
{
itemsRepository.deleteById(id);
}/close this post once your question has been answered!๐ค Post marked as dormantThis post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.