public void JSON(Object object,String charset){ getHttpResponse().setCharacterEncoding(charset); getHttpResponse().setContentType("text/html;charset="+charset); try { JSONUtil.serialize(getHttpResponse().getWriter(), object); getHttpResponse().getWriter().flush(); getHttpResponse().getWriter().close(); } catch (Exception e) { e.printStackTrace(); } }
JSON格式输出Struts2
时间: 2024-10-11 17:28:50