Java-SpringMvc-响应Html代码展示

代码

    @RequestMapping(value = "/test.do", method = {RequestMethod.GET})
    public void test(HttpServletResponse response) {
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out= null;
        try {
            out = response.getWriter();
        } catch (IOException e) {
            e.printStackTrace();
        }
        out.println("<div style='width:600px;height:600px;border:1px solid red;'>我是模板信息</div>");
    }

 

posted @ 2017-03-29 14:25  bjlhx15  阅读(1040)  评论(0编辑  收藏  举报
Copyright ©2011~2020 JD-李宏旭