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

  • Home
  • SEARCH
  • 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 8335409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:40:12+00:00 2026-06-09T03:40:12+00:00

I have requirement like a Java class member variables has to be accessed by

  • 0

I have requirement like a Java class member variables has to be accessed by 3 or more JSP files. The input to the java class will be a property file. Passing the property file to the constructor will populate the class member variables. This variables will be used by 3 or more JSP files. So instead of creating different instance with same property file, if the instance is once created and if all the JSP can access it, which will be efficient. Currently my idea is making the java class as singleton or other one is create the instance and keep it in a session and let all the jsp to access it. I feel singleton class is more appropriate. Is my decision rite or any other more efficient way is there ?

  • 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-06-09T03:40:13+00:00Added an answer on June 9, 2026 at 3:40 am

    I would only advice to keep objects in session which are session dependent. In this case, since you have to make the variable accessible in 3 different jsp’s and these values are not dependant on individual request, better to store the object in application context.

    Use ServletContext’s getAttribute() and setAttribute() methods.Store the values in Application Scope and you should be done for good.

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

Sidebar

Related Questions

I have requirement like, suppose I have a 'property' table which has 'ListingKey' field
I have a requirement to combine 4 xml files into one. They are like
For my ipad application i have requirement like this For each row in root
I am working in JTable and I have a requirement like this. Say There
I have requirement as following like showing ABPeoplePickerNavigationController in tabbar based application. I researched
I have a requirement which sounds like kind of simple but hard to implement
I have requirement where some times I would like to load children as well
I have a requirement. Given say Test1,Test2, I have to perform a like operation.
I have an requirement of generating two excel files at once. We are using
I am trying to create a Response class in Java which has a method

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.