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 Spring in Action this week in the Spring 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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

Moving this to the Servlets forum for you.
 
Don't get me started about those stupid light bulbs.
 
subject: How to have checkbox value blank instead of "null"