Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp - checkbox information retieval problem

 
kishani liyanage
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey i need some help! I have a jsp which has a list of checkboxes to select from. I want to know how i can display the selected checkboxes using another jsp. Please illustrate if u can = My jsp is given below!
<form action="showDetails.jsp" method=GET>
<input type=hidden name=action value=0>
<tr bgcolor="#9999FF">
<td><br></b></td>

<td><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
Item Description</font></br><td>
<td><b><font face="Verdana, arial,Helvetica, sans-serif" size="2">
Price</font></b></td>
<td><b><font face="Verdana, Aria, Helvetica, sans-serif" size="2">
In Stock</font></b></td>
<td><b><font face="verdana, Arial, Helvetica, sans-serif" size="2">
Quantity in stock</font></b></td>

</tr>
<%
//Get the catalog entries
Vector items = Catalog.getItems();

for (int i =0; i<items.size(); i++) {
Item myitem =(Item)items.elementAt(i);
%>
<tr>
<td><input type=checkbox name=itemId
value=<%= myitem.getItemId() %> ></td>
<td><%= myitem.getDescription()%></td>
<td><%= myitem.getPrice() %></td>
<td><%= myitem.getAvailable() %></td>
<td><%= myitem.getQuantity_in_stock() %></td>
</tr>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since all the checkboxes have the same name, you can get the list of checked values with request.getParameterValues().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic