日期:2014-05-17 浏览次数:20776 次
<form name="fom" id="fom" method="post" action="Book-Search.action"> <td width="538">按 <select name="keyword1"> <option>请选择</option> <option value="productID">图书产品号</option> <option value="categoryname">分类名</option> <option value="bookname">图书名</option> <option value="author">作者</option> <option value="publisher">出版社</option> </select> 搜索: <input type="text" name="keyword2" value="请输入关键字" /> <input name="Submit4" type="submit" class="right-button02" value="查 询" /> </td> </form>
<s:iterator value="bms" id="b"> <tr bgcolor="#FFFFFF"> <td height="20"><input type="checkbox" name="delid"/></td> <td bgcolor="#FFFFFF"><s:property value="#b.productID"/></td> <td><s:property value="#b.categoryname"/></td> <td><s:property value="#b.bookname"/></td> <td><s:property value="#b.publisher"/></td> <td><s:property value="#b.publishdate"/></td> <td><s:property value="#b.author"/></td> <td><s:property value="¥#b.unitprice"/></td> <td bgcolor="#FFFFFF" align="center"> <a href="Book-UpdateInput.action?productID=<s:property value="#b.productID" />">编辑</a>| <!-- <a href="searchBook.jsp">查看该类别所有图书</a>| --> <a href="Book-Delete.action?productID=<s:property value="#b.productID"/>" onclick="return checkDel();">删除</a> </td> </tr> </s:iterator>
private ABookService bs = new ABookService(); //private ACategoryService cs = new ACategoryService(); private List<BookModel> bms; private String keyword1; private String keyword2; //省略get set方法(keyword1 2 等等) //条件模糊查询 public String findAll(){ try { bms = ABookService.findAll(keyword1, keyword2); System.out.println("!!!!!"+keyword1+keyword2); //bm = new BookModel(); } catch (Exception e) { e.printStackTrace(); } return SUCCESS; }
//模糊查询 public static List<BookModel> findAll(String keyword1, String keyword2) throws Exception{ Connection conn = ConnectionDB.getConn(); ArrayList<BookModel>all = new ArrayList<BookModel>(); String sql = "select * from bookInfo where ? = ?"