我想用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>
<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>
解决方案 »
- 急!高手进!用Freemarker生成word的奇怪问题!
- java正则截取字符串
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]第 1
- 如何把servlet的参数传到bean里面去啊!???????
- tomcat为什么不能访问
- 大家讨论下关于实现网站统计的策略
- 求助~~
- SSO客户端访问报错。。求救
- 刷新问题:用location.reload(true)刷新页面,总要弹出“不重新发信息则无法刷新页面”
- 高分求助:关于jdbc 问题,jsp
- 求助,hibernate中使用SQL语句,其中包含冒号:,该怎么处理啊?
- dtree树复选框添加半选状态
<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呢?
<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>