response.getWriter().write()与response.getWriter().print()
经实测,以上两种方法都是输出,没感觉到有什么差异;
API文档中介绍write()方法比较简单
介绍print()方法说:
public void print(String s)
Prints a string. If the argument is null then the string "null" is printed. Otherwise, the string's characters are converted into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String username = config.getInitParameter("username");
String password = conf......<br/><strong>答案就在这里:</strong><a target='_blank' rel='nofollow' href='http://blog.csdn.net/oJoker1123456789/article/details/51336942'>Servlet中write方法和print方法的区别</a><br/>----------------------Hi,地球人,我是问答机器人小S,上面的内容就是我狂拽酷炫叼炸天的答案,除了赞同,你还有别的选择吗?
write 是写出,,print 是打印。。。。输出方式不一样