314 questions
0 votes
1 answer
60 views
How to use different DTOs in the same @ModelAttribute between GET and POST in Spring MVC?
I'm working on a Spring Boot + Thymeleaf application where I have an edit page. In my controller, I want to use different DTOs for the GET and POST methods: ResponseDto for displaying data and ...
2 votes
0 answers
72 views
Using Kotlin value class with @ModelAttribute in Spring (multipart/form-data binding issue)
@JvmInline value class Email( @field:Size(max = 100) @field:Email val value: String, ) data class RequestVerifyEmail( val email: Email . . . ) @PostMapping fun verifyEmail(@...
0 votes
1 answer
47 views
Form URL encoded data and Spring Rest Controller, data coming as null
We are getting a request from 3rd part and in our logs the body is printed like this "body":"Response=%7B%22TransactionType%22%3A1%2C%22Approved%22%3Afalse%2C%22TransactionIdentifier%22%...
0 votes
1 answer
60 views
Spring in Action 6th/ch05: Why the design.html works here without @ModelAttribute added to the taco method parameter?
View(design.html): https://github.com/habuma/spring-in-action-6-samples/blob/main/ch05/taco-cloud/src/main/resources/templates/design.html ... <form th:method="POST" th:object="${...
0 votes
1 answer
1k views
Spring Boot: @ModelAttribute is null in controller method when using with multipart/form-data
I have a Spring Boot controller method that handles file uploads, and I'm trying to use the @ModelAttribute annotation to bind some fields from the request. Here's my controller method: @PostMapping(...
0 votes
1 answer
102 views
Should the name of a @ModelAttribute be the same as the model in a session
Should the name of a @ModelAttribute be the same as a model before it would be saved in a session? I have a an attribute with a different name from the model but it is not saving in the session. ...
0 votes
2 answers
1k views
How @ModelAttribute for method parameter work in Spring MVC
i'm very new in spring mvc so i have very confused about how @modelAttribute work in spring mvc and i have situation right down my JSP: <%-- Document : login Created on : Apr 3, 2023, ...
1 vote
1 answer
238 views
POST : @ModelAttribute not convert Map object of wrapper DTO
I need your help to solve a @ModelAttribute problem qith a java Map object. Context The following REST Controller expose a POST api that accept a wrapper dto. @Validated @RestController @Slf4j @...
0 votes
1 answer
372 views
Unable to fetch values to View(JSP) from Controller using @ModelAttribute in Spring Boot
I'm unable to fetch the values from Controller(Home.java) to View (home_view.jsp) in Spring Boot. home.jsp <body> <div class="container mt-10"> <form ...
3 votes
0 answers
757 views
Swagger-UI gives null value for @ModelAttribute having multipart form-data
I have an rest API whose request payload is an object(POJO). The structure of the object is defined below: @Data public class ExtractionRequest implements Serializable { private static final long ...
0 votes
1 answer
837 views
Take input from Thymeleaf. Translate into ModelAttribute. Doesn't recognize the @ModelAttribute bean. Cannot redirect to new page
I am trying to create a new Movie. This means that I want to access the "addMovie" URL, to generate a form in which I add the title of a new movie. This title should be stored in a movieDTO ...
1 vote
1 answer
226 views
Micronaut - What is the @ModelAttribute equivalent
In Spring I know I can bind thymeleaf form inputs to a command object using @ModelAttribute in the controller, but is there an equivalent in Micronaut? I can't see it documented anywhere
1 vote
0 answers
173 views
Spring Boot Application: NullPointerException using @ModelAttribute
I'm getting a NullPointerException in these @ModelAttribute variables. Here is my code: @RequestMapping(value="/newUser", method=RequestMethod.POST) public String newUser(@Validated @...
0 votes
1 answer
532 views
Spring web mvc + Thymeleaf ModelAttribute editing the list in the object
I have a form for editing a user, the user has roles, which are a list of objects of type Authority, I want to be able to use checkboxes (optional) to set the roles that the user will have, but I have ...
1 vote
1 answer
845 views
Spring MVC @GetMapping @ModelAttribute percent(%) symbol gives null value
Here is my controller: @CrossOrigin(origins = "http://localhost:3000") @RestController @RequestMapping("/api/v1/employees") public class EmployeeController { @Autowired ...