String s;
int i=0;
if(s.equals("惠普激光打印机")
   i=0;
if(s.equals("xx")
   i=1;
sql="select * from mytable where typeid="+i;

解决方案 »

  1.   

    注意jsp文件要有<% page import="java.sql.*"%>
    连接数据库要有相应的数据库连接包jar
      

  2.   

    可以分段让用户输入,或用request.getParametervalues()得到数组
      

  3.   

    先用String cond = new String(request.getParameter("condition").getBytes("ISO8859_1"));接受用户输入的内容然后select * from 表名 where 品牌 like '%"+cond+"%';就是一个模糊查找 用like 和 %来来匹配其他的信息 用cond来匹配关键字信息不知道这样能不能解决你的问题。