高级搜索条件查询 第一次查询时pageBean实体由request域带回到list页面 pageBean实体中存放的url用来为分页访问 保存之前查询的条件
高级搜索中的表单提交 request.queryString 可以获得。
BookDao:
1 //按bid查询 2 public Book findByBid(String bid) throws SQLException 3 { 4 String sql="select * from t_book where bid=?"; 5 //一行记录中包含book的属性还有cid的属性 6 Map<String,Object> map=qr.query(sql, new MapHandler(),bid); 7 //把map中除了cid之外的属性映射到book中 8 Book book=CommonUtils.toBean(map,Book.class); 9 // 把map中的cid属性映射到category中 ,即category中只有cid这个属性 10 Category category=CommonUtils.toBean(map, Category.class); 11 //二者建立关联属性 12 book.setCategory(category); 13 return book; 14 15 }
desc.jsp
<div class="divBookName">${book.bname }</div>
<div>
<img align="top" src="<c:url value='/${book.image_w }'/>" class="img_image_w"/>
<div class="divBookDesc">
<ul>
<li>商品编号:${book.bid }</li>
<li>打折价:<span class="price_n">¥${book.currPrice }</span></li>
<li>定价:<span class="spanPrice">¥${book.price }</span> 折扣:<span style="color: #c30;">${book.discount }</span>折</li>
</ul>
<hr class="hr1"/>
<table>
<tr>
<td colspan="3">
作者:${book.author }
</td>
</tr>
<tr>
<td colspan="3">
出版社:${book.press }著
</td>
</tr>
<tr>
<td colspan="3">出版时间:${book.publishtime}</td>
</tr>
<tr>
<td>版次:${book.edition }</td>
<td>页数:${book.pageNum }</td>
<td>字数:${book.wordNum }</td>
</tr>
<tr>
<td width="180">印刷时间:${book.printtime }</td>
<td>开本:${book.booksize } 开</td>
<td>纸张:${book.paper }</td>
</tr>
</table>
<div class="divForm">
<form id="form1" action="<c:url value='/jsps/cart/list.jsp'/>" method="post">
<input type="hidden" name="method" value=""/>
<input type="hidden" name="bid" value=""/>
我要买:<input id="cnt" style="width: 40px;text-align: center;" type="text" name="quantity" value="1"/>件
</form>
<a id="btn" href="javascript:$('#form1').submit();"></a>
</div>
</div>
</div>