我想用jsp间的参数传递实现searchForm.jsp里的关键字参数传递到productList.jsp里再用SQL语句搜索商品的功能,可是参数怎么都传不过去。本人还是初学者,求各位大虾解答searchForm.jsp
<table border="0" width="100%" cellspacing="0" height="70">
         <tr>
            <td height="28" bgcolor="#FFFFCC" align="center">输入商品关键字查询商品信息</td>
         </tr>
         <tr>
           <td valign="top" bgcolor="#FFFFCC">  
             <form method="post" action="productList.jsp">
              商品名称:<input name="keyword" type="text"  size="16">

                <input type="image" border="0" name="imageField" src="img/search.gif" width="35" height="19">
             </form>
           </td>
         </tr>
</table>productList.jsp这边request部分使用JSTL写的
<%   request.setCharacterEncoding("GB2312");  %><sql:setDataSource driver="sun.jdbc.odbc.JdbcOdbcDriver"
                   url="jdbc:odbc:shnxn" var="dsShop" scope="application"/><c:choose>
   <c:when test="${param.keyword ne null}">
<sql:query sql="select Pid,TypeId,name,abstract,MemberPrice,VIPPrice,MarketPrice,picture from product where name like %?%"
           dataSource="${applicationScope.dsShop}"  var="rs" scope="session">
           <sql:param value="${param.keyword }"/>
       </sql:query>
   </c:when>
   <c:when test="${param.category ne null}">
<sql:query sql="select Pid,TypeId,name,abstract,MemberPrice,VIPPrice,MarketPrice,picture from product where TypeId=?"
           dataSource="${applicationScope.dsShop}"  var="rs" scope="session">
           <sql:param value="${param.category}"/>
       </sql:query>
   </c:when>
   <c:otherwise>
<sql:query sql="select Pid,TypeId,name,abstract,MemberPrice,VIPPrice,MarketPrice,picture from product"
           dataSource="${applicationScope.dsShop}"  var="rs" scope="session"/>
   </c:otherwise>
</c:choose>

解决方案 »

  1.   

    searchForm.jsp
    <table border="0" width="100%" cellspacing="0" height="70">
      <tr>
      <td height="28" bgcolor="#FFFFCC" align="center">输入商品关键字查询商品信息</td>
      </tr>
      <tr>
      <td valign="top" bgcolor="#FFFFCC">  
      <form method="post" action="productList.jsp">
    商品名称:<input name="keyword" type="text" size="16">
      <input type="image" border="0" name="imageField" src="img/search.gif" width="35" height="19">
      </form>
      </td>
      </tr>
    </table>你的表单没有提交啊?
    submit呢?
      

  2.   

    <table border="0" width="100%" cellspacing="0" height="70">
             <tr>
                <td height="28" bgcolor="#FFFFCC" align="center">输入商品关键字查询商品信息</td>
              </tr>
              <tr>
         <td valign="top" bgcolor="#FFFFCC">
     
                <form method="post" action="productList.jsp">
                          卡片名称:<input name="keyword" type="text"   size="16">
                          <input type="submit"  value="搜 索" >
                </form>
    </td>
              </tr>
              </table>