Originally posted by Satou kurinosuke: I think that you won't get true or false, but only the names of checkboxes that were checked when submitted. If the checkboxex have the same name, you'll have to call getParameterValues
In his first post, the original poster was checking for "on" (the default value for a checked box) with the String.equalsIgnoreCase method; which returns true or false.
This brings up another issue that I should have mentioned in the first post. The code:
will throw an NullPointerException if the checkbox is not checked. In this case you will be trying to call a method of the String object when the string is null.
A more solid way of testing this would be to turn that line around.
Originally posted by Gregg Bolinger: Isn't it safe to assume that you can just check for null?
Yep. I was pointing out a more general issue that people run into when testing form parameters. Checkboxes are somewhat unique in that null can be an expected value. [ August 17, 2006: Message edited by: Ben Souther ]