该功能可以实现以商品的名字模糊查询和精确查询。
后台程序:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
DataBaseHelper d = new DataBaseHelper();
request.setCharacterEncoding("UTF-8");
ResultSet rs = d.query("select * from product where ownerid="+request.getSession().getAttribute("id").toString());
request.setAttribute("rs", rs);
request.getRequestDispatcher("mypro.jsp").forward(request, response);
}运行结果:
以下是搜索全部信息的结果。