摘要:
request --> 封装了客户端所有的请求数据!请求行请求头空行请求体(GET没体) 回忆一下http协议!请求协议中的数据都可以通过request对象来获取! * 获取常用信息 > 获取客户端IP,案例:封IP。request.getRemoteAddr() > 请求方式,re... 阅读全文
摘要:
response:其类型为HttpServletResponse ServletResponse-->与协议无关的类型 HttpServletResponse-->与http协议相关的类型 回忆一下http协议!http协议中响应的内容包含哪些东西呢? * 状态码:200表示成功、302表示... 阅读全文
摘要:
ServletContext application = this.getServletContext(); Integer count = (Integer)application.getAttribute("count"); if(count == null) { count = 1; } el... 阅读全文
摘要:
一、ServletContext是Servlet三大域对象之一(session、request、Application(ServletContext))。 一个项目只有一个ServletContext对象! 我们可以在N多个Servlet中来获取这个唯一的对象,使用它可以给多个Servlet传递... 阅读全文
摘要:
Servlet接口一共5个方法,但其中只有三个是生命周期方法: * void init(ServletConfig) * void service(ServletRequest,ServletResponse) * void destory()还有两个方法为:*ServletConfig g... 阅读全文