• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to fetch the value of the checkbox in jsp?

 
sanat meher
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ramkumar Subburaj
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry use request.getParameterValues() insteda of request.getParameterNames
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic