springmvc中输出字符串

    /**
     * 输出文字
     * @param response
     * @param s
     */
    public static void responseOut(HttpServletResponse response,String s){
        response.setContentType("text/html;charset=UTF-8");
        response.setCharacterEncoding("UTF-8");
        try (
                PrintWriter pw = response.getWriter()
                ){
            pw.write(s);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

  

posted @ 2017-09-01 15:10  抱明月  阅读(1610)  评论(0编辑  收藏  举报