Announcement Announcement Module
No announcement yet.
spring:bind for boolean value Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring:bind for boolean value

    How does Spring handle boolean values?

    My command object has two boolean datatypes with getter/setter pair. In the html I have a select with choices which will either give "true" or "false" when submittet.

    Will Spring convert these to boolean true or false when it is populating the command object from my spring:bind in the html ?

    Or do I have to make sure Spring does this myself and in that case how ?

  • #2
    I believe I am correct in remembering that Spring handles this properly, but don't off the top of my head know if the bind variable ends up being a Boolean (e.g. Boolean.TRUE) or String. If you're using JSTL to output or compare the bound value, it really doesn't matter.