Java-jsp the session object of the built-in object gets additional information about the session

Source: Internet
Author: User
Tags java web

Related information:
"21-Day Learning Java Web Development"

Session Object

Get additional information about the session

sessiondemo2.jsp

1 <%@ Page Language="Java"ContentType="text/html;charset=gb2312" %>2 <HTML>3 <Head>4   <title>Get additional information about the session</title>5 </Head>6 <Body>7   <%8     LongCreattime=session.getcreationtime ();//get the session generation time9 Out.println ("time generated by session:"+Creattime+"<br>");//output Session generation timeTen     StringSessionID=Session.getid ();//get the ID of the session One Out.println ("ID of Session:"+SessionID+"<br>");//the ID of the output session A     LongLasttime=session.getlastaccessedtime ();//gets the last time the request was sent through the session - Out.println ("last time the request was sent through the session:"+Lasttime+"<br>");// -     Booleanisnew=session.isnew ();//determine if the session is new the Out.println ("Is the new:"+isnew);//output session is not new -   %> - </Body> - </HTML>
View Code

The session object of the java-jsp built-in object gets additional information about the session

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.