Hi friends,
i want to pass values through diffrent hyperlink.The scenario is like this.
I have a tabular data with checkbox corresponding to each row.When i ll select the checkboxes,then those values shouldbe displayed on the same page and the corresponding hyperlink is also there through the same value.I have used iterator to pass multiple values,but the selected checkbox values are not being displayed because iterator.next is not working multiple times.
can anybody guide me how to display multiple values and also pass values through that hyperlink..
The code for the same is here :
code:
--------------------------------------------------------------------------------
<body>
<div align="center"><u><strong>INDEXER PAGE</strong></u></div><form id="form1" name="form1" method="post" action="indexer.jsp"> <p> INDEXING LIST</p>
<% Connection conn=null;try{
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/trackingsystem","root","root");
} catch(SQLException e) {
System.out.println("SQLException: " + e.getMessage());
while((e = e.getNextException()) != null)
System.out.println(e.getMessage());
} catch(ClassNotFoundException e) {
System.out.println("ClassNotFoundException: " + e.getMessage()); } ResultSet rs=null;
Statement stmt = conn.createStatement(); // sql query to retrieve values from the secified table.
String QueryString = "SELECT * from indexinfo";
rs = stmt.executeQuery(QueryString);%>
<table cellpadding="15" border="3" style="background-color: #ffffcc;"> <tr> <td><b>BATCH</b></td>
<td width="145"><b>SCANED DATE(YYYY-MM-DD)</b></td>
<td width="140"><b>DUE DATE</td>
<td width="167"><b>INDEX DATE</td>
<td width="228"><b>TOTAL NO OF PAGES</td> </tr>
<% while (rs.next()) { %>
<tr> <td><input type="checkbox" name="batch" value= "<%=rs.getString("batch")%>" /><%=rs.getString("batch")%></td>
<td><%=rs.getDate("scandate")%></td>
<td><%=rs.getDate("duedate")%></td>
<td><%=rs.getDate("indexdate")%></td>
<td><%=rs.getInt("totalpages")%></td>
</tr> <% }
rs.close();
stmt.close();
conn.close();
%> </table>
<p>
<input type="submit" name="button" id="button" value="SUBMIT" />
</p> <p> </form>
<form id="form2" name="form2" method="post" action="">
<% ArrayList items=new ArrayList();
String[] itemselected; String itemname; itemselected=request.getParameterValues("batch");
if(itemselected!=null){
for(int i=0;i<itemselected.length;i++){ itemname=itemselected[i];
items.add(itemname);
} }
Iterator iterator=items.iterator();
out.println("<u><b> The batches that u selected: </b></u>");
out.println("<u><b> Click on any batch you want to index </b></u>"); // while(iterator.hasNext()){
/ out.println("<p>" +iterator.next()+ "</p>");
// } while(iterator.hasNext()){
out.println( "<p><a href=\"indexing_inprocess.jsp?value=" +iterator.next()+"\"> </p>" );
out.println("</a>");
} %>
<p> </p> </body>
--------------------------------------------------------------------------------
thanks,
Sanat