aspose file tools*
The moose likes Servlets and the fly likes How to have checkbox value blank instead of Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to have checkbox value blank instead of "null"" Watch "How to have checkbox value blank instead of "null"" New topic
Author

How to have checkbox value blank instead of "null"

vanan saravanan
Ranch Hand

Joined: Jun 02, 2006
Posts: 95
I have a couple of checkbox in my jsp page. Those which are ticked pass their values correctly to the database. Those that are unticked pass a "null" value to the database. I dont want a "null" value but just an empty field. How do i do that.

This is my code

String checkbox1 = request.getParameter("Checkbox1");
Saket Barve
Ranch Hand

Joined: Dec 19, 2002
Posts: 229
What difference would that make in the logic, Vanan? Either way, you know that the checkbox value is unchecked.

And this post is in the wrong forum!
[ October 14, 2006: Message edited by: Saket Barve ]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29230
    
135

Vanan,
Just add the logic yourself:


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29230
    
135

Moving this to the Servlets forum for you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to have checkbox value blank instead of "null"
 
Similar Threads
checkbox not availeable(simple problom)
checkboxes from a query , How to ?????
CheckBox Status
how to show whick checkbox is checked in jsp page without submit?
Tips on form-based authetication