wood burning stoves
The moose likes JSP and the fly likes Return type of checkbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic

Return type of checkbox

Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Hi All,
I'm trying to return to set the value returned by a checkbox(whether checked or not) to a bean variable.However Imnot sure what the return type of the checkbox would be .
Is it boolean or String?
Thanks for helping.

Learning and Learning!-- Java all the way!
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63547

All request parameters are strings. That's the way HTTP works.

Various frameworks, and tools like BeanUtils, can convert these strings to other types, but the submitted data itself is always a string.

[Asking smart questions] [About Bear] [Books by Bear]
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Thanks for the reply it worked !
Stefan Evans

Joined: Jul 06, 2005
Posts: 1519
You should note that standard HTML checkboxes will submit
- their value if they are checked (or ON if there is no value defined)
- no request parameter if they are unchecked.

Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Hi Stefan ,
Thanks for replying!
I think I'm missing something of the sort ,but cant figure how to work around it . Ive posted it in the post:
Your comment would be much appreciated.
I agree. Here's the link: http://aspose.com/file-tools
subject: Return type of checkbox
jQuery in Action, 3rd edition