java代码:
public void returnMessage(HttpServletResponse response, Object str){
?????PrintWriter write = null;
?????try{
????????write = response.getWriter();
????????write.print(str);
?????}catch(IOException e){
????????e.printStackTrace();
?????}finally{
????????write.close();
?????}}
其实也可以把它包装成一个公共类。然后供其它Controller层继承使用。
公共返回JSON信息的方法
原文地址:https://www.cnblogs.com/wuliMan/p/10551184.html