---
title: "identifying  which check boxes are selected using JAVA (  jsp)"  
description: "identifying  which check boxes are selected using JAVA (  jsp)"  
author: "Anonymous User"  
published: 2015-12-07  
updated: 2015-12-07  
canonical: https://www.mindstick.com/forum/33690/identifying-which-check-boxes-are-selected-using-java-jsp  
category: "java"  
tags: ["java", "jsp"]  
reading_time: 2 minutes  

---

# identifying  which check boxes are selected using JAVA (  jsp)

I am [building](https://www.mindstick.com/blog/23088/which-tonewood-is-suitable-for-building-a-guitar) a servlet that displays a [simple](https://yourviews.mindstick.com/story/1469/5-simple-ways-to-stay-fit-amp-healthy) form with checkboxes , when the [user](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) selects the number of checkboxes he wants and clicks on a "[confirm](https://answers.mindstick.com/qa/115761/facebook-account-locked-with-confirm-your-identity-loop)" the POST [request](https://www.mindstick.com/blog/255/post-get-and-request-function-in-php) in my servlet checks for which boxes have been checked and [queries](https://www.mindstick.com/forum/33678/sub-queries-in-sql-server) the [database](https://www.mindstick.com/articles/12226/use-of-database-in-sencha-extjs-and-insert-record-from-user-form-using-ajax) based .\
I am unsure on how to do this in Java as the user may [select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) either 1 or more checkboxes . if somebody could [explain](https://www.mindstick.com/forum/157854/what-is-system-debugging-explain-some-system-debugging-tools-used-in-modern-computer-systems) this with a small example this would be great.\
I am very new to [programming](https://www.mindstick.com/articles/12214/web-development-company-in-india-laid-on-the-foundation-of-concrete-java-programming) and would provide a code snippet if I knew how to do it .

## Replies

### Reply by Anonymous User

This is actually the HTML form behavior question. When you check a few checkboxes with one "name" attribute and different "value" attributes and press submit button, your browser will send request to the server with checked checkbox values. So you can get value names from this url parameters.\
For example:\

```
<form name="input" action="html_form_action.asp" method="get"><input type="checkbox" name="vehicle" value="Bike">I have a bike<br><input type="checkbox" name="vehicle" value="Car">I have a car <br><br><input type="submit" value="Submit"></form>
```

If you check both of checkboxes your server will receive this parameters like so:\

```
http://example.com/your_page.jsp?vehicle=Bike&vehicle=Car 
```

After that you can get values like this:\

```
String checkboxValues = request.getParameter("vehicle");
```

checkboxValues gets all values separated by comma.


---

Original Source: https://www.mindstick.com/forum/33690/identifying-which-check-boxes-are-selected-using-java-jsp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
