jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes How to get Names of selected checkboxes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to get Names of selected checkboxes?" Watch "How to get Names of selected checkboxes?" New topic
Author

How to get Names of selected checkboxes?

Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 632

Hi..
I want to know that how we can get names of selected checkboxes?

Thanks


Life is easy because we write the source code.....
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63334
    
  70

The names of the selected checkboxes will be submitted as request parameters with the value assigned to each checkbox.

Non-selected checkboxes will not be passed at all.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 632

Hello Sir, Thanks for quick reply,

I have following html file in which user can select checkboes




and I have following Servlet class



Now when I hit the Url I get Output as from which department I had selected the book . Now I want to print the name of book also How I can do this in servlet .

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63334
    
  70

Your HTML is incomplete. The checkboxes have no value attributes to distinguish between them.
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 632

oh yes

This is my new HTML file

Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 632

Thank You Sir, because of incomplete Html code I had not getting the name of the book But now I got it.

Thanks again.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63334
    
  70

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get Names of selected checkboxes?
 
It's not a secret anymore!