• 每日总结


      老师给出的要求是多条件查询,因此就要添加查询条件,因此我就是将查询条件也封装成了一个Bean类,然后对查询论文的方法进行修改,以此来实现多条件查询。

    代码如下:

    public void findlunwen(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException {
    request.setCharacterEncoding("utf-8");
    int tonum=Integer.parseInt(request.getParameter("sum"));
    int realnum=Integer.parseInt(request.getParameter("realsum"));
    List<demBean> findlist=new ArrayList<>();
    demBean dbean=null;
    dbean=new demBean("AND",request.getParameter("tiaojian"),request.getParameter("firinput"),request.getParameter("jingzhun"));
    findlist.add(dbean);
    for(int i=1;i<tonum;i++) {
    if(request.getParameter("input"+i)!=""&&request.getParameter("input"+i)!=null) {
    dbean=new demBean(request.getParameter("lianjie"+i),request.getParameter("tiaojian"+i),request.getParameter("input"+i),request.getParameter("jingdu"+i));
    findlist.add(dbean);
    }
    }

    System.out.println(realnum+"总数为"+findlist.size());
    for(int i=0;i<findlist.size();i++) {
    System.out.println(findlist.get(i).toString());
    }
    PrintWriter out = response.getWriter();
    //String name = request.getParameter("name").trim();
    List<lunwenBean> list = dao.getselectlunwen(findlist);
    JSONArray json=new JSONArray();
    for(int i=0;i<list.size();i++) {
    JSONObject ob=new JSONObject();
    ob.put("title", list.get(i).getTitle());
    ob.put("zuozhe", list.get(i).getZuozhe());
    ob.put("zhaiyao", list.get(i).getZhaiyao());
    ob.put("time", list.get(i).getTime());
    ob.put("lianjie", list.get(i).getLianjie());
    json.add(ob);
    }
    //System.out.println("JSON"+json.toString());
    System.out.println("zongshu"+list.size());
    out.write(json.toString());

    }

  • 相关阅读:
    【phpmailer】类Could not instantiate mail function / IXWebHosting空间
    Delphi通过机器码获得注册码的完整方案
    月末使用期间损益结转
    如何停用已启用模块
    DevExpress安装
    用Delphi实现WinSocket高级应用
    如何用delphi读取网卡物理号
    Delphi制作带图标的弹出式选单
    Register Delphi ,Delphi 不能运行
    远程通:系统管理不可以使用
  • 原文地址:https://www.cnblogs.com/ruangongwangxiansheng/p/14914863.html
Copyright © 2020-2023  润新知