日期:2014-05-18  浏览次数:20836 次

如何向一个jsp传递两个以上的参数,如商品的名称和数量?(商品的名称和数量取自数据库 是动态的)
如何向一个jsp(orderform.jsp)传递两个以上的参数,如商品的名称和数量?(商品的名称和数量取自数据库   是动态的)
用checkbox只能取得商品名称,如何把本行的商品数量也传递过去呢?忘各位大虾帮忙,小弟不胜感激;)

////////////////////////product.jsp
<%@   page   language= "java "   import= "java.util.*,java.sql.* "   pageEncoding= "ISO-8859-1 "%>
 
<jsp:useBean   id= "con "   scope= "session "   class= "test.DBCon "/>
<html>
    <head>
    <title> Welcome   to   products   page </title>
    </head>
      <%@include   file= "Title.html "   %>  
    <body>
    <%  
    con.getCon();  
    String   action=request.getParameter( "action ");  
    String   pname=request.getParameter( "pname ");    
    String   pnum=request.getParameter( "num ");  
    String   price=request.getParameter( "price ");    
    try{  
    String   username=session.getValue( "name ").toString();    
    if(username==null){%>
        you   haven 't   login <%}
        else{
    %> Welcome   <%=username%> ,the   time   now   is <%=new   java.util.Date().toString()%>
      <a   href= "AlterUserInformation.jsp "> Alter   my   information </a> <%
      }
      }catch(Exception   ex){
      out.println( "you   haven 't   login,please   back   to   Login   Page ");
      }%>  

 
          <form   action= "orderform.jsp "   name= "form2 ">
          <table   bgcolor= "#708491 ">
          <tr>
          <td   width= "25% "> Product   Name </td>   <td   width= "25% "> Price </td>
          </tr>
          <%  
          Statement   stmt=con.getStmtread();
          ResultSet   rs=stmt.executeQuery( "select   *   from   product ");        
          while(rs.next()){%>
          <tr>
<td   width= "20% "> <%=rs.getString( "ProdName ")%> </td>
<td   width= "20% "> <%=rs.getFloat( "Price ")%> </td>
<td   width= "15% "> Number: </td>
<td   width= "10% "> <input   size=2   type= "text "   id= "num "   name= "num "   value= "1 ">   </td>
<td   width= "10% "> <input   size=2   type= "checkbox "   id= "want "   name= "want &q