Skip to content
Advertisement

Post DTO to Spring Controller, parameters are null

I am trying to Post a list of strings from my Javascript front end to a Spring Boot Controller, for some reason the post happens, but my values are null. Is there anything obviously wrong with my code?

Front end:

JavaScript

Wrapper:

JavaScript

Controller:

JavaScript

Debug – Breakpoint:

breakpoint reveals getBemsids is null

ids is null

Advertisement

Answer

Annotation requestbody is used for restful applications & modelattribute for web mvc..you are mixing both and that is the issue here. Can you try changing requestbody with modelattribute and use form data instead xhr request to send data from frontend.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement