我在Java中写了个servlet,主要是接受ajax传来的值,并且返回XML字符串,但是同样的条件,在FIREFOX下能在浏览器里正常显示并返回给客户端,IE下不能在浏览器中显示,也就没办法返回给客户端了An invalid character was found in text content. Error processing resource 'http://localhost:8080//..public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { response.setContentType("text/xml;charset=utf-9");
//试过ISO-8859-1,也不行
PrintWriter out = response.getWriter();
out.print(str);
out.flush();
out.close();
}请问怎样才能解决IE下的这个问题
throws ServletException, IOException { response.setContentType("text/xml;charset=utf-9");
//试过ISO-8859-1,也不行
PrintWriter out = response.getWriter();
out.print(str);
out.flush();
out.close();
}请问怎样才能解决IE下的这个问题
解决方案 »
- 做项目的时候,什么时候需要重启tomcat?什么时候是不必要的?
- ibatis 多值逻辑判断的写法?
- hibernate中的分页查询 请高手指点..
- 求助:html:select与html:options的用法
- struts 在任何页面操作之后如何跳回本页!
- servlet与applet的通信程序,老是调不同,那位大哥帮我看一下
- 请问:如何在一窗体中显示一坐标系呢
- jbuilder8.0+weblogic7.0+oracle9i能否在WIN98下使用?在线等待,急急急
- 关于weblogic下载的问题
- 各位老大,给出每个标签是作什么用的!在线等待,全部答出立即给分,不够再加!多谢!!!1
- 看图答题,答对给分。。。
- WebSphere 客户认证问题
它里面有图形化的向导: help conTents-> MyEclipse Learning center->web services development->getting started-> 而且目前用Xfire用的比较多!
网上很多的介绍,我觉得都是从引申出来的,看原创,可以觉得深入一些。
out.print(str);
这里应该是utf-8吧
内容是从数据库中读出来的,请问各位如何才能把这种字符代替掉
if (input == null) {
input = "";
return input;
}
input = input.trim().replaceAll("/[\\x00-\\x08]/", "");
input = input.trim().replaceAll("/[\\x0b-\\x0c]/", "");
input = input.trim().replaceAll("/[\\x0e-\\x1f]/", "");
return input;
}