Search in sources :

Example 6 with Info24Dao

use of com.zyf.dao.Info24Dao in project HeartWatchdogJsp by Viczyf.

the class Info24Servlet method select_con_list.

public void select_con_list(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    Info24Dao info24Dao = new Info24Dao();
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    // List infoList = info24Dao.queryInfo24(uid);
    // JsonArray array = new JsonArray();
    int id = MyTools.strToint(request.getParameter("id"));
    Info24 single = info24Dao.queryInfoSingle(id, uid);
    JsonObject ob = new JsonObject();
    String conclusion = "";
    String addr = single.getConclusionaddr();
    String file = request.getSession().getServletContext().getRealPath("/") + "24holter/conclusion/" + addr;
    try {
        BufferedReader rd = new BufferedReader(new FileReader(file));
        String s = rd.readLine();
        while (null != s) {
            conclusion += s;
            s = rd.readLine();
        }
        rd.close();
    // System.out.println(str);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    conclusion = "[" + conclusion + "]";
    ob.addProperty("con", conclusion);
    // array.add(ob);
    PrintWriter out = response.getWriter();
    out.print(ob);
    out.flush();
    out.close();
}
Also used : Info24Dao(com.zyf.dao.Info24Dao) User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) JsonObject(com.google.gson.JsonObject) Info24(com.zyf.bean.Info24)

Aggregations

Info24 (com.zyf.bean.Info24)6 User (com.zyf.bean.User)6 Info24Dao (com.zyf.dao.Info24Dao)6 HttpSession (javax.servlet.http.HttpSession)6 JsonObject (com.google.gson.JsonObject)3 RequestDispatcher (javax.servlet.RequestDispatcher)3 JsonArray (com.google.gson.JsonArray)2 List (java.util.List)2