首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

关于servlet中response的sethead跟addhead

2013-09-05 
关于servlet中response的sethead和addheadresponse.sethead(name,liudehua1)response.addhead(name

关于servlet中response的sethead和addhead
response.sethead("name","liudehua1");
response.addhead("name","liudehua2");
response.sethead("name","liudehua3");

第三行代码,会把前面两个name都替换掉,还是只会替换掉其中的一个呢。
[解决办法]
自己写一个servlet测试以下。

URL url = new URL("http://localhost:8080/apps/Servlet/Test");
URLConnection uc = url.openConnection();
Map<String, List<String>> headers = uc.getHeaderFields();
System.out.println(headers);
一目了然了。
[解决办法]
自己写代码试一下

热点排行