sql="select * from student where id<>-1";if(request.getParameter("name")!=null) sql+=" and name='"+request.getParameter("name")+"'";if(request.getParameter("age")!=null) sql+=" and name='"+request.getParameter("age")+"'";//..........有多少个搜索条件就写多少了,如果所有request都有空,就执行select * from student where id<>-1,由于id不可能为-1,所以就等于列出所有数据了。
jsp中的useBean动作指令来引入你事先写好的一个类,
这个类封装了你查询数据库后返回的结果集,
然后你在这个jsp页面中使用<% ************ %>来
解析这个结果集输出到本页面就可以了.
sql+=" and name='"+request.getParameter("name")+"'";if(request.getParameter("age")!=null)
sql+=" and name='"+request.getParameter("age")+"'";//..........有多少个搜索条件就写多少了,如果所有request都有空,就执行select * from student where id<>-1,由于id不可能为-1,所以就等于列出所有数据了。
这是服务器脚本 加载页面时会先执行它的
...
}
会不会不停的刷页面