⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httpsession.html

📁 j2ee帮助文档软件设计/软件工程 文件格式
💻 HTML
📖 第 1 页 / 共 3 页
字号:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>As of Version 2.2, this method is                        replaced by <A HREF="../../../javax/servlet/http/HttpSession.html#getAttributeNames()"><CODE>getAttributeNames()</CODE></A></I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpSession.html#invalidate()">invalidate</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Invalidates this session then unbinds any objects bound to it.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpSession.html#isNew()">isNew</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns <code>true</code> if the client does not yet know about the session or if the client chooses not to join the session.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpSession.html#putValue(java.lang.String, java.lang.Object)">putValue</A></B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;name,         <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>&nbsp;value)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>As of Version 2.2, this method is                        replaced by <A HREF="../../../javax/servlet/http/HttpSession.html#setAttribute(java.lang.String, java.lang.Object)"><CODE>setAttribute(java.lang.String, java.lang.Object)</CODE></A></I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpSession.html#removeAttribute(java.lang.String)">removeAttribute</A></B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;name)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Removes the object bound with the specified name from this session.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpSession.html#removeValue(java.lang.String)">removeValue</A></B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;name)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>As of Version 2.2, this method is                        replaced by <A HREF="../../../javax/servlet/http/HttpSession.html#removeAttribute(java.lang.String)"><CODE>removeAttribute(java.lang.String)</CODE></A></I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpSession.html#setAttribute(java.lang.String, java.lang.Object)">setAttribute</A></B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;name,             <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>&nbsp;value)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Binds an object to this session, using the name specified.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)">setMaxInactiveInterval</A></B>(int&nbsp;interval)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Specifies the time, in seconds, between client requests before the  servlet container will invalidate this session.</TD></TR></TABLE>&nbsp;<P><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="getCreationTime()"><!-- --></A><H3>getCreationTime</H3><PRE>long <B>getCreationTime</B>()</PRE><DL><DD>Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.<P><DD><DL><DT><B>Returns:</B><DD>a <code>long</code> specifying                                        when this session was created,                                        expressed in                                         milliseconds since 1/1/1970 GMT<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this method is called on an                                        invalidated session</DL></DD></DL><HR><A NAME="getId()"><!-- --></A><H3>getId</H3><PRE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getId</B>()</PRE><DL><DD>Returns a string containing the unique identifier assigned  to this session. The identifier is assigned  by the servlet container and is implementation dependent.<P><DD><DL><DT><B>Returns:</B><DD>a string specifying the identifier                                        assigned to this session</DL></DD></DL><HR><A NAME="getLastAccessedTime()"><!-- --></A><H3>getLastAccessedTime</H3><PRE>long <B>getLastAccessedTime</B>()</PRE><DL><DD>Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight January 1, 1970 GMT, and marked by the time the container received the request.  <p>Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.<P><DD><DL><DT><B>Returns:</B><DD>a <code>long</code>                                        representing the last time                                         the client sent a request associated                                        with this session, expressed in                                         milliseconds since 1/1/1970 GMT<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this method is called on an                                        invalidated session</DL></DD></DL><HR><A NAME="getServletContext()"><!-- --></A><H3>getServletContext</H3><PRE><A HREF="../../../javax/servlet/ServletContext.html" title="interface in javax.servlet">ServletContext</A> <B>getServletContext</B>()</PRE><DL><DD>Returns the ServletContext to which this session belongs.<P><DD><DL><DT><B>Returns:</B><DD>The ServletContext object for the web application<DT><B>Since:</B></DT>  <DD>2.3</DD></DL></DD></DL><HR><A NAME="setMaxInactiveInterval(int)"><!-- --></A><H3>setMaxInactiveInterval</H3><PRE>void <B>setMaxInactiveInterval</B>(int&nbsp;interval)</PRE><DL><DD>Specifies the time, in seconds, between client requests before the  servlet container will invalidate this session.  A negative time indicates the session should never timeout.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>interval</CODE> - An integer specifying the number                                of seconds</DL></DD></DL><HR><A NAME="getMaxInactiveInterval()"><!-- --></A><H3>getMaxInactiveInterval</H3><PRE>int <B>getMaxInactiveInterval</B>()</PRE><DL><DD>Returns the maximum time interval, in seconds, that  the servlet container will keep this session open between  client accesses. After this interval, the servlet container will invalidate the session.  The maximum time interval can be set with the <code>setMaxInactiveInterval</code> method. A negative time indicates the session should never timeout.<P><DD><DL><DT><B>Returns:</B><DD>an integer specifying the number of                        seconds this session remains open                        between client requests<DT><B>See Also:</B><DD><A HREF="../../../javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)"><CODE>setMaxInactiveInterval(int)</CODE></A></DL></DD></DL><HR><A NAME="getSessionContext()"><!-- --></A><H3>getSessionContext</H3><PRE><A HREF="../../../javax/servlet/http/HttpSessionContext.html" title="interface in javax.servlet.http">HttpSessionContext</A> <B>getSessionContext</B>()</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>As of Version 2.1, this method is                        deprecated and has no replacement.                        It will be removed in a future                        version of the Java Servlet API.</I><P><DD><DL></DL></DD></DL><HR><A NAME="getAttribute(java.lang.String)"><!-- --></A><H3>getAttribute</H3><PRE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>getAttribute</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;name)</PRE><DL><DD>Returns the object bound with the specified name in this session, or <code>null</code> if no object is bound under the name.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - a string specifying the name of the object<DT><B>Returns:</B><DD>the object with the specified name<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this method is called on an                                        invalidated session</DL></DD></DL><HR><A NAME="getValue(java.lang.String)"><!-- --></A><H3>getValue</H3><PRE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>getValue</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;name)</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>As of Version 2.2, this method is                        replaced by <A HREF="../../../javax/servlet/http/HttpSession.html#getAttribute(java.lang.String)"><CODE>getAttribute(java.lang.String)</CODE></A>.</I><P><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - a string specifying the name of the object<DT><B>Returns:</B><DD>the object with the specified name<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this method is called on an                                        invalidated session</DL>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -