前端之家收集整理的这篇文章主要介绍了
ajax后台处理响应(java),
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
public static final void sendAsJson(HttpServletResponse response,String str)
{
response.setContentType("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("text/html;charset=UTF-8");
if (null != str)
try {
response.getWriter().write(str);
} catch (IOException e) {
e.printStackTrace();
}
}
原文链接:https://www.f2er.com/ajax/162257.html