发表于: 2016-11-26 22:49:18

0 2130


一.今天完成的事情

    1.使用Task1中的Service完成接口的实现。(完成20%) 

      我返回的是JSP视图。效果图:

             

  2.引入了Json-tagLib  jar包 效果如下:

     GitHub链接:https://github.com/wangshouxiang/task2_spring_rest

二.明天的计划

    1.使用Task1中的Service完成接口的实现。(使用JSON完成)

三.遇到的问题

    1.MySQL无缘无故出错:Can't connect to MySQL server on localhost (10061)(已解决)

        http://www.cnblogs.com/onlycxue/p/3291889.html

        http://blog.csdn.net/love_baobao/article/details/6922939 (第一种方法解决)

    2.思考:JSON-taglib是一套使在JSP页面中输出JSON格式数据的标签库。 明天看Json与java的关系。也就                     是在java中直接输入json格式,供前端处理。如下形式:

protected void processRequest(HttpServletRequest request, HttpServletResponse response)

            throws ServletException, IOException {

        String idParam = request.getParameter("id");

        String belongUserIdParam = request.getParameter("belongUserId");

        response.setContentType("text/html;charset=UTF-8");

        PrintWriter out = response.getWriter();

        ObjectMapper objectMapper = new ObjectMapper();

        Map<String, Object> resp = new HashMap<String, Object>();

        List jsonList = new LinkedList();

        if (idParam == null && belongUserIdParam == null) {

            resp.put("code", "3001");

            resp.put("message", CodeConfig.getValue("3001"));

            objectMapper.writeValue(out, resp);

            return;

        }

                    。。。。。。

}

四.收获

    1.看了一下Servlet的Listener--filter--servlet

    2.引入了Json-tagLib  jar包 看了一下文档包含三个标签:

       <json:object>/<json:property><json:array>

四.总结

    1.很明显贪玩啦,今天做了一个小时的任务。明天起,静心做任务,加快速度

    2.顺便吐槽一下GitHub真的很慢,以后的小伙伴希望你们用一下Git@OSC(但这个是中文欧)



返回列表 返回列表
评论

    分享到