javax.servlet.http:
Interface HttpServletRequest
this interface extends the interface ServletRequest to provide request interformation for the http HTTP servlets.
The servlet container creates an HttpServletRequest object and passes it as an argument to the servlet's service methods (doGet, doPost, etc).
Method:
getContextPath(): obtain the project's name '/example'
getCookies():return an array containing all of the Cookie objects the client send with this request
getHeader():
getMethod()
getPathInfo()
getRequestSessionId()可能跟session的id不同,如果客户没有指定一个会话ID,此方法返回null。
getRequestURI() 获得项目的http 请求的uri
getRequestURL()获得url
ps: url和uri的区别 url是通过浏览器访问的地址名称,uri是项目路径没有http和网络地址相关信息
getSession() 获得当前session
getSession(boolean create) 如果create=true 则建立一个新的session,create=false则返回null或者获得当前session
Servlet 3.0中增加的 authenticate().login(),logout()这三个方法实在不知道怎么用啊。。第一次觉得网上的资料好少。
Interface HttpServletResponse
addCookie(Cookie cookie)
addHeader(String name,String value)
setRedirect(String loaction)
encodeURL(String url) return String:重写url 在cookie被当前大多数浏览器禁用的时候,可以选择重写url这方式来报错session的跟踪。
Interface HttpSession:
Method:
getAttribute()
setAttribute()
getCreationTime()
getId()
getMaxInactiveInterval()
setMaxInactiveInterval()
getServletContext()
invalidate():是当前的session失效,如果调用这个方法后 在执行有关session的操作
如session.getAttribute就是报500的错
isNew()
removeAttribute()
Interface HttpSessionAttributeListener:
对session中的属性情况进行了监听
method:
attributeAdded(HttpSessionAttributeEvent)
attributeRemoved(HttpSessionAttributeEvent)
attributeReplaced(HttpSessionAttributeEvent)
Interface HttpSessionListener
对session的初始化和销毁情况进行了监控
method:
sessionCreated(HttpSessionEvent)
sessionDestroyed(HttpSessionEvent)
Interface HttpSessionBindingListener
对绑定到session属性的对象进行了监听
valueBound(HttpSessionBindingEvent)
valueUnbound(HttpSessionBindingEvent)
HttpSessionActivationListener
是对不同VM之间session的交互的监听
method:
sessionDidActivate(HttpSessionEvent)
sessionWillPassivate(HttpSessionEvent)
常用类:
Cookie
HttpServlet
<-----------------------以前没用过的------------->
HttpServletRequestWrapper
HttpServletResponseWrapper
分享到:
相关推荐
javax.servlet.http.HttpSessionBindingListener.class javax.servlet.http.HttpSessionBindingEvent.class javax.servlet.http.HttpSessionEvent.class javax.servlet.http.HttpSession.class javax.servlet....
javax.servlet.jsp_2.0.0.v201101211617.jar,javax.,servlet,jsp
javax.servlet.jar与javax.servlet.jsp.jar
在ejb中没有的两个jar文件javax.servlet.jar,javax.servlet.jsp.jar
javax.servlet.jsp.jstl-api-1.2.1.jar
TagSupport SimpleTagSupport tagext javax servlet jsp Tag 标签
java servlet src源码包 javax.servlet.* javax.servlet.http.* javax.servlet.jsp.*
JSTL(Java server pages standarded tag library,即JSP标准标签库)是由JCP(Java community Proces)所制定的标准规范,它主要提供给Java Web开发人员一个标准通用的标签库,并由Apache的Jakarta小组来维护。...
javax.servlet.jsp.jstl-1.2.1.zip
JSTL的jar包,源码和API,POM文件
javax.servlet.jsp-api-2.3.1.jar
javax.servlet.jsp.jar.zip(72 k).zipvjavax.servlet.jsp.jar.zip(72 k).zip
javax.servlet.zip\javax\servlet javax.servlet.zip\javax\servlet\http javax.servlet.zip\javax\servlet\jsp javax.servlet.zip\javax\servlet\jsp\tagext 源码
javax.servlet---jsp-api jar包,很常用,欢迎下载!内含javax.servlet&jsp;-api jar包
javax.servlet.jsp-api-2.3.2的jar包
javax.servlet-api-3.1.0.jar,很多程序无法运行都是因为他!!!加了就好了
web项目里面开发jsp页面的时候,使用action调用servlet里面get和post方法的时候需要这个jar包,来获取 请求路径的
javax.servlet.jsp.ErrorData.java javax.servlet.jsp.HttpJspPage.java javax.servlet.jsp.JspApplicationContext.java javax.servlet.jsp.JspContext.java javax.servlet.jsp.JspEngineInfo.java javax.servlet....