上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 40 下一页
  2014年5月15日
摘要: 编写一个RegistServlet处理用户的Get请求数据 1 public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { ... 阅读全文
posted @ 2014-05-15 22:23 wf110 阅读(12479) 评论(0) 推荐(0) 编辑
摘要: 输出数字不同: write()输出数字转换为字符,println原样输出。输出null不同: write()输出引用类型的时候调用的toString转换为String数据,因此如果对象为null那么直接抛出空指针异常。Println直接输出null。 阅读全文
posted @ 2014-05-15 19:22 wf110 阅读(379) 评论(0) 推荐(0) 编辑
摘要: 多学一招:如果一个网站中既有图片又有文本,那么请问需要使用什么流?Repsonse不可能同时获取字节流和字符流,对于以上的问题是由于HTTP通信原理没有掌握清楚才导致。浏览器发送请求处理的一定是页面,但是页面中的图片表现的形式不是字节流的方式而是直接发送给浏览器即可,浏览器会检索该src指定的路径继... 阅读全文
posted @ 2014-05-15 17:20 wf110 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 1 // 获取网站对象 2 ServletContext context = this.getServletContext(); 3 // 获取网站资源 4 String path = context.getRealPath("/imgs/人.j... 阅读全文
posted @ 2014-05-15 14:56 wf110 阅读(815) 评论(0) 推荐(0) 编辑
摘要: 1.在web项目中如果直接添加一个资源,那么相对路径相对的是tomcat的bin目录。 2.在包中直接指定资源,那么可以使用以下的相对路径直接获取资源: InputStream in = this.getClass().getResourceAsStream("jnb.txt");3.在web项目... 阅读全文
posted @ 2014-05-15 12:28 wf110 阅读(355) 评论(0) 推荐(0) 编辑
摘要: /a /ff.do *do这三种写法是对的 阅读全文
posted @ 2014-05-15 11:08 wf110 阅读(426) 评论(0) 推荐(0) 编辑
摘要: 1 获取网站资源(重点) 2 public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { 3 // 获取网... 阅读全文
posted @ 2014-05-15 10:50 wf110 阅读(452) 评论(0) 推荐(0) 编辑
摘要: 问题:使用以下的代码演示servlet的线程安全问题? 1 public class MultiThreadQuestion extends HttpServlet { 2 public int count = 0; 3 public void doGet(HttpServletRe... 阅读全文
posted @ 2014-05-15 09:47 wf110 阅读(241) 评论(0) 推荐(0) 编辑
  2014年5月14日
摘要: HTTP1.1 提供了一个必须的Host字段,而且建立好一次连接之后可以重复使用。提高用户的上网体验。响应信息HTTP/1.1 200 OK ->响应行Server: Apache-Coyote/1.1Set-Cookie: JSESSIONID=A8FB52…; Path=/day04 ->响应... 阅读全文
posted @ 2014-05-14 18:18 wf110 阅读(348) 评论(0) 推荐(0) 编辑
摘要: 请求信息GET / HTTP/1.1 ->请求行Accept: */*Accept-Language: zh-cn,en-US;q=0.5 ->请求头User-Agent: Mozilla/4.0Accept-Encoding: gzip, deflateHost: www.sina.com.cn... 阅读全文
posted @ 2014-05-14 18:07 wf110 阅读(427) 评论(0) 推荐(0) 编辑
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 40 下一页