Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7680617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:09:22+00:00 2026-05-31T18:09:22+00:00

I am confused with cookies and using session in servlets in jsp’s and servlets.

  • 0

I am confused with cookies and using session in servlets in jsp’s and servlets. I have 3 questions.

1. I am creating a session for a user in my servlet A and then putting a few values in the session object. Then if the user accesses another servlet B in the same domain, will the servlet be able to read the values. Will the same session object be available to the servlet B.?
2. If I have 5 tabs open containg the different jsp pages of the same server(or domain). Will the method sessio.lastAccessed() for all the 5 tabs return the same value?

3. Can expiry be set for a session object? If yes, how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:09:23+00:00Added an answer on May 31, 2026 at 6:09 pm
    1. yes, they will share the session

    2. yes, I believe tabs always share a session, but multiple windows will depend on the browser — you can have multiple instances of IE (separate windows), for example, and they won’t.

    3. yes, by setting session-config/session-timeout in web.xml (number of minutes, see below)

      <session-config>
        <session-timeout>15</session-timeout>
      </session-config>

    also, to set the session timeout programmatically, use this method:

    HttpSession session
    session.setMaxInactiveInterval(int interval)
    

    where interval is measured in seconds.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am confused about authentication with BlazeDS. Most of the few examples I have
In ASP.NET, I'm a bit confused about role of cookies in session state. Whats
I am new to JSP/Servlets/MVC and am writing a JSP page (using Servlets and
Bit confused here, I have an on-demand instance but do I get charged even
Totally confused here. I have a PARENT UIViewController that needs to pass an NSMutableArray
Totally confused by this one... We have a WAMPServer installation set up, running a
I am bit confused about ADO.Net Data Services. Is it just meant for creating
Do i login using cookies or sessions in a login system? I've seen examples
Ok, I've asked a few related questions here and only ended up with more
There are various ways to maintain user state using in web development. These are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.