//接收col
String col = request.getParameter("col");
//接收str
String str = request.getParameter("str");
//创建业务逻辑层对象
imp_StudentBiz isd = new imp_StudentBiz();
List<Student> slist = null;
if(col!=null) {//如果不为空说明点击了查询按钮
slist = isd.getByLike(col, str);
}else {//没有点击查询按钮,默认查询所有
slist = isd.getByLike("sname", "");
}
//调用查询方法
// List<Student> slist = isd.getByLike("sname","");
//把集合内置对象
request.setAttribute("slist", slist);
//转发
request.getRequestDispatcher("index.jsp").forward(request, response);
Servlet显示
最新推荐文章于 2024-11-09 12:43:52 发布