zl程序教程

您现在的位置是:首页 >  后端

当前栏目

Java-SpringMvc-响应Html代码展示

2023-09-14 09:08:49 时间

代码

    @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>");
    }