aspose file tools*
The moose likes Spring and the fly likes Cannot submit unchecked checkbox to Controller. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Cannot submit unchecked checkbox to Controller." Watch "Cannot submit unchecked checkbox to Controller." New topic
Author

Cannot submit unchecked checkbox to Controller.

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1075
I have a simple check box defined in a JSP like this:



In the controller, I have a @ReqestParam defined like this:



Yet, when I submit the form, if the checkbox was unchecked, I get the error: "The request sent by the client was syntactically incorrect ()."

If the checkbox is checked, then it works.

I've tried changing the type to boolean as the type in the Controller, but get the same behavior.

So, how do you handle a checkbox correctly so that you can determine, when submitted to the Controller that it was *not* checked?

(the controller never seems to run if the checkbox was not checked)

Thanks in advance.

--mike
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1075
The issue was that I had multiple "@RequestParam" elements in the method definition instead of one with multiple parameters listed.

- mike
 
jQuery in Action, 2nd edition
 
subject: Cannot submit unchecked checkbox to Controller.