Answer the question
In order to leave comments, you need to log in
How to work with rest api using json and user input at the same time?
Hello, I have a rest controller that works with data, receiving and issuing them in json format:
@GetMapping(value = "/employee/{empNo}",
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public Employee getEmployee(@PathVariable("empNo") String empNo){
return employeeDAO.getEmployee(empNo);
}
@PostMapping(value = "/employee",
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public Employee addEmployee(@RequestBody Employee emp) {
logger.info("(Service Side) Creating employee: " + emp.getEmpNo());
return employeeDAO.addEmployee(emp);
}
<form th:action="@{/register}"
th:object="${personForm}" method="POST">
Answer the question
In order to leave comments, you need to log in
It's called: "Write a frontend to an existing backend."
We make an html form, take a ToadScript, write a form submission event handler, in it, instead of the default behavior, we send an html request to your server, where the back is spinning, we receive data in the response, generate a table from them, add it to the page. And voila: you are a full stack developer! :).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question