File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes how to fetch the value of the checkbox in jsp? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to fetch the value of the checkbox in jsp?" Watch "how to fetch the value of the checkbox in jsp?" New topic
Author

how to fetch the value of the checkbox in jsp?

sanat meher
Greenhorn

Joined: Nov 06, 2008
Posts: 18
Hi everyone,

Can anybody help me out how to get the value of the checkbox value in a variable using getparameter or anything else in jsp..
The scenario is like this,I have list of data that is displayed in tabular form(row n column wise)and those data are retrived from the database only..In one column,i have check boxes corresponding to each row.So when i select check boxes(more than one),then that corresponding row values should be retrived and to be displayed in anothor page or frame.But i dont know how to retrive those values in jsp..

The code for those tabular data is like this:


Thanks in advance,
Sanat

[ November 14, 2008: Message edited by: sanat meher ]

[ November 14, 2008: Message edited by: sanat meher ]
[ November 14, 2008: Message edited by: Bear Bibeault ]
Ramkumar Subburaj
Ranch Hand

Joined: Sep 07, 2007
Posts: 83
give all the check boxes the same name and assign each one with a different value, say the rows primary key.

Use request.getParameterNames() in the servlet and you will get an array which will have only the checked values


SCJP 1.5, SCWCD 1.4.
Hanging between Web Services and EJB
Ramkumar Subburaj
Ranch Hand

Joined: Sep 07, 2007
Posts: 83
sorry use request.getParameterValues() insteda of request.getParameterNames
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2718
    
    6

Its not a good programming practice to have all that database code in a JSP, you should be using a bean.

Are you not familiar with EL?


SCJP, SCWCD.
|Asking Good Questions|
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to fetch the value of the checkbox in jsp?