k_k_grass
发贴: 29
积分: 0
|
于 2003-05-03 11:01
一个页面循环产生了多个同一类型的Bean,如何使用<jsp:setPrperty id="item" property="*"/>以便另一个页面读取这些Bean's property? <jsp:useBean id="item" class="mymusic.servlets.ItemBean"/> <% try{ String strQuery1 = "select * from Item_Master where Type='"+songtype+"'"; ResultSet result=dao.executeQuery(strQuery1); String username, itemcode,title, qty, wishdate; float rate; Vector vctSelected=new Vector(1,1); while(result.next()){ //生成一个Bean的相应property out.println("<tr>"); out.println("<td width=\"25%\"><font face=\"Arial\" size=\"2\" color=\"#800000\">"); out.println("<font face=\"Arial\" size=\"2\" color=\"#800000\">"); itemcode=result.getString("Item_code"); out.println("<p><input type=\"checkbox\" name="+itemcode+" value=\"ON\">"); out.println("</td>"); out.println("<td width=\"25%\"><font face=\"Arial\" size=\"2\" color=\"#800000\">"); title=result.getString("Title"); out.println(title); out.println("</td>"); out.println("<td width=\"25%\"><font face=\"Arial\" size=\"2\" color=\"#800000\">"); rate=result.getFloat("Rate"); out.println(Float.toString(rate)); out.println("</td>"); out.println("<td width=\"25%\"><font face=\"Arial\" size=\"2\" color=\"#800000\">"); out.println("<input type=\"text\" name=\"qty\" size=\"5\" value=\"1\" >"); out.println("</td>"); out.println("</font>"); out.println("</tr>"); } dao.close(); } catch(Exception e) { out.println("Exception: " + e + " occured."); } %>
|