It's a bit a shame but I just started with front end developping.
My Problem : I have a html page with a form and the submission requestbody is not transfered to the back end.
I'm using spring boot, spring security, thymeleaf.
Here the Controller :
RegistrationController java class
package my.package;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(path = "/registration")
@AllArgsConstructor
public class RegistrationController {
private RegistrationService registrationService;
@PostMapping
public String register(@RequestBody RegistrationRequest request){
registrationService.register(request);
return "Registration need to be confirmed";
}
@GetMapping(path = "confirm")
public String confirm(@RequestParam("token") String token) {
return registrationService.confirmToken(token);
}
}
With PostMan the request works as a Post request with the body as json:
{
"firstName": "firstName",
"lastName": "lastName",
"email": "firstName.lastName@gmail.com",
"password": "password"
}
But when I implement the html page as following :
registration page
<div>
and fill the formular and press submit the business services dont succeed : got 415 status error
With DevTools i see the Payload nicely filled
I do not understand why the @RequestBody don't get filled with the payload data. Maybe the problem is somewhere else. I don't understand why in postman the request works but not in the browser
Thank you for all the help you can bring
Alex
