摘要: ServletContext&Request&Session 三个域对象的总结:ServletContext:Servlet收到请求,产生数据,显示完了,等会还要用,而且还要给别人用,就存在ServletContext里。Request:Servlet收到请求,产生数据,显示完了,数据没用了,就存在... 阅读全文
posted @ 2013-04-25 18:43 魅惑之眼 阅读(212) 评论(0) 推荐(0) 编辑
摘要: Session:Session实现原理:浏览器未禁用Cookie:Jsp代码: My JSP 'index.jsp' starting page 购买 结账 Servlet代码://购买public class SessionDemo1 extends HttpS... 阅读全文
posted @ 2013-04-24 21:11 魅惑之眼 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 会话:保存会话数据的两种技术:Cookie技术:Session技术:Cookie API:Cookie应用:Servlet代码://代表网站首页public class CookieDemo1 extends HttpServlet { public void doGet(HttpServletRe... 阅读全文
posted @ 2013-04-24 16:56 魅惑之眼 阅读(137) 评论(0) 推荐(0) 编辑
摘要: request常用方法:Servlet代码:public class RequestDemo1 extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) th... 阅读全文
posted @ 2013-04-23 17:11 魅惑之眼 阅读(182) 评论(0) 推荐(0) 编辑
摘要: request和response简介response常见应用:向客户端输出中文数据:1.用OutputStream输出:Servlet代码://在servlet中用outputStream(可以写任何类型数据)输出数据的问题以及输出中文的问题public class ResponseDemo1 ex... 阅读全文
posted @ 2013-04-22 21:11 魅惑之眼 阅读(440) 评论(0) 推荐(0) 编辑
摘要: 一般用于写验证码String base = "\u7684\u4e00\u4e86\u662f\u6211\u4e0d\u5728\u4eba\u4eec\u6709\u6765\u4ed6\u8fd9\u4e0a\u7740\u4e2a\u5730\u5230\u5927\u91cc\u8bf4\... 阅读全文
posted @ 2013-04-22 12:33 魅惑之眼 阅读(964) 评论(0) 推荐(0) 编辑
摘要: 得到ServletContext的方式:public class ServletDemo6 extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) thro... 阅读全文
posted @ 2013-04-21 21:14 魅惑之眼 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Web.xml配置文件: ServletDemo5 cn.itcast.ServletDemo5 data1 xxxxx data2 yyyyy data3 zzzzz charset UTF... 阅读全文
posted @ 2013-04-21 21:03 魅惑之眼 阅读(125) 评论(0) 推荐(0) 编辑
摘要: //线程安全(网页)public class ServletDemo4 extends HttpServlet implements SingleThreadModel{ int i = 0; //子类覆盖父类的方法,不能抛出比父类更多的异常 public void doGet(HttpServl... 阅读全文
posted @ 2013-04-21 20:52 魅惑之眼 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2013-04-21 20:45 魅惑之眼 阅读(112) 评论(0) 推荐(0) 编辑