*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

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
Marshal

Joined: Jan 10, 2002
Posts: 60755
    
  65

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] [Bear's FrontMan] [About Bear] [Books by Bear]
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Thanks for the reply it worked !
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
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:
http://www.coderanch.com/t/538471/JSP/java/Return-value-checkbox-throwing-NPE
Your comment would be much appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Return type of checkbox
 
Similar Threads
problem in reading from checkbox
JDialog
Eval to convert innerHTML to object
Remembering the radiobtn/checkbox state between jsp pages
checkbox