how to get the value of the checked checkboxes in my controller?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to get the value of the checked checkboxes in my controller?

Priya
Hi ..
I'm using thymeleaf and springs
Can anyone let me know how to get the value of the checked checkboxes in my controller.
any example for same?  

Reply | Threaded
Open this post in threaded view
|

Re: how to get the value of the checked checkboxes in my controller?

Zemi
Administrator
Hello,

this is more a SpringMVC question than a Thymeleaf question.

In order to get a request parameter you can do either of the following options:

- Use request.getParameter("...") as in other Java web application.

- Use a @RequestParam annotation (see http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/mvc.html#mvc-ann-requestparam )

- Use a command bean with some boolean field.

In Spring documentation you will find examples of all methods. If you want an example with Spring + Thymeleaf combined, look a the documentation
    http://www.thymeleaf.org/documentation.html
There are two good example applications:
- Example Application: Spring Thyme Seed Starter Manager
- Example Application: Thymeleaf-PetClinic