• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Cannot submit unchecked checkbox to Controller.

 
Bartender
Posts: 1938
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1938
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The issue was that I had multiple "@RequestParam" elements in the method definition instead of one with multiple parameters listed.

- mike
 
reply
    Bookmark Topic Watch Topic
  • New Topic