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);
}

@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);
}

7 Replies
JavaBot
JavaBot•3y ago
Hey, @dlu! Please remember to /close this post once your question has been answered!
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
dlu
dluOP•3y ago
essentially, we have an items class on springboot java, and we need to have the html page access the items class to display items
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
dlu
dluOP•3y ago
basically im using spring boot to make a website that uses a databases items
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
JavaBot
JavaBot•3y ago
💤 Post marked as dormant
This 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.

Did you find this page helpful?