Or you could just do it that way:
public String controllerMethod(@RequestParam(value="myParam[]") String[] myParams){
....
}
That works for example for forms like this:
<input type="checkbox" name="myParam[]" value="myVal1" />
<input type="checkbox" name="myParam[]" value="myVal2" />
This is the simplest solution 🙂
Related Contents:
- Spring MVC type conversion : PropertyEditor or Converter?
- How to prevent parameter binding from interpreting commas in Spring 3.0.5?
- What’s the difference between @Component, @Repository & @Service annotations in Spring?
- How to use multiple @RequestMapping annotations in spring?
- Trigger 404 in Spring-MVC controller?
- Difference between the annotations @GetMapping and @RequestMapping(method = RequestMethod.GET)
- What is username and password when starting Spring Boot with Tomcat?
- How to set base url for rest in spring boot?
- How to fix Hibernate LazyInitializationException: failed to lazily initialize a collection of roles, could not initialize proxy – no Session
- Spring MVC – How to return simple String as JSON in Rest Controller
- How to return a custom object from a Spring Data JPA GROUP BY query
- Passing multiple variables in @RequestBody to a Spring MVC controller using Ajax
- Autowiring two beans implementing same interface – how to set default bean to autowire?
- Spring Boot Adding Http Request Interceptors
- How to accept Date params in a GET request to Spring MVC Controller?
- The type WebMvcConfigurerAdapter is deprecated
- What’s the point of Spring MVC’s DelegatingFilterProxy?
- No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor
- @Autowired – No qualifying bean of type found for dependency
- Why does Spring MVC respond with a 404 and report “No mapping found for HTTP request with URI […] in DispatcherServlet”?
- HttpSecurity, WebSecurity and AuthenticationManagerBuilder
- Return only string message from Spring MVC 3 Controller
- Sending GET request with Authentication headers using restTemplate
- UnsatisfiedDependencyException: Error creating bean with name
- What is the difference between @ComponentScan and @EnableAutoConfiguration in Spring Boot?
- Spring Boot Actuator without Spring Boot
- Alternatives to JSP for Spring MVC view layer [closed]
- Disable Spring Security for OPTIONS Http Method
- Spring MVC (async) vs Spring WebFlux
- How to serve .html files with Spring
- Spring Bean Scopes
- Manually call Spring Annotation Validation
- Unable to complete the scan for annotations for web application [/app] due to a StackOverflowError
- Unable to mock Service class in Spring MVC Controller tests
- what is the difference between Spring and Spring MVC framework
- What is the HTTP status return code for a successful DELETE statement in REST?
- Spring RequestMapping for controllers that produce and consume JSON
- Spring Security hasRole() not working
- Error in Java Import statement “The import javax.validation.constraints.NotNull cannot be resolved”
- How to handle MaxUploadSizeExceededException
- Is it possible to set a bean name using annotations in Spring Framework?
- Java Spring – how to handle missing required request parameters
- Spring MVC – Binding a Date Field
- Getting java.lang.ClassNotFoundException: javax.servlet.ServletContext in JUnit
- Struts2 vs Spring 3 [closed]
- Get Spring Security Principal in JSP EL expression
- Get last records ordered by date on Spring Data
- Spring security does not allow CSS or JS resources to be loaded
- application context. What is this?
- Autowiring fails: Not an managed Type