ajax后台处理响应(java)

前端之家收集整理的这篇文章主要介绍了ajax后台处理响应(java)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
public static final void sendAsJson(HttpServletResponse response,String str)  
{  
  response.setContentType(@H_404_12@"application/json;charset=UTF-8");  
  if (null != str)  
    try {  
      response.getWriter().write(str);  
    } catch (IOException e) {  
      e.printStackTrace();  
    }  
}  

public static final void sendAsText(HttpServletResponse response,String str)  
{  
  response.setContentType(@H_404_12@"text/html;charset=UTF-8");  
  if (null != str)  
    try {  
      response.getWriter().write(str);  
    } catch (IOException e) {  
      e.printStackTrace();  
    }  
}

猜你在找的Ajax相关文章