Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How can I share objects across different sessions?

Answers were Sorted based on User's Feedback



How can I share objects across different sessions?..

Answer / sanjeev kumar

Information (It can be primitives or objects) can be shared
across different servlets in 3 ways in J2EE.
1) Request object-- If the data need to be shared with in
the request scope we can set it on request object with
request.setAttribute() method. And can be accessed from the
other servlet or JSP with request.getAttribute() method.

2) Session object-- If the data need to be shared with in
the session scope we can set it on session object with
session.setAttribute() method. And can be accessed from the
other servlet or JSP with session.getAttribute() method.

3) Context object-- If the data need to be shared with in
the context (Application) scope we can set it on context
object with context.setAttribute() method. And can be
accessed from the other servlet or JSP with
context.getAttribute() method.

Is This Answer Correct ?    16 Yes 4 No

How can I share objects across different sessions?..

Answer / aman kumar

with the help of session.setAttribute()and session.getAtribute()we can share Httpsession object across different servlet and jsp.

Is This Answer Correct ?    5 Yes 0 No

Post New Answer

More Servlets Interview Questions

What is cgi and what are its drawbacks?

0 Answers  


Is classes folder is compulsory in web-inf/ even though u r deploying ur application with war file?

3 Answers   Bosch, Cognizant,


Explain servlet events?

0 Answers  


can v create a constructor 4 servlet?

7 Answers   Satyam,


Explain web application directory arrangement?

0 Answers  


What is the difference between ExecuteUpdate and ExecuteQuery?

4 Answers  


Whats the advantages using servlets over using CGI?

0 Answers  


what are the way a client can be tracked?

3 Answers   ABC, IBM,


Write all the phases defined in servlet life cycle?

0 Answers  


What do you mean by web applications? Explain web application directory arrangement?

0 Answers  


When is the servlet instance created in the life cycle of servlet? What is the importance of configuring a servlet?

0 Answers  


What are the security issues in Servlets?

2 Answers  


Categories