This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Servlets and the fly likes How to access data in another servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to access data in another servlet" Watch "How to access data in another servlet" New topic

How to access data in another servlet

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I have a servletA that reads a serialized object into memory.
It then displays a JSP page which shows the different field data of that object. These fields would be links to another servletB.
I don't want to read in the object twice, how would servletB get access to the object in memory in servletA?
Is there a way to do this without EJB?
Tony Alicea

Joined: Jan 30, 2000
Posts: 3222
I am assuming that it's an HttpServlet so I guess you could put the object in the <B>request</B> object with the setAttribute() method and forward to ServletB...

Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
I agree. Here's the link:
subject: How to access data in another servlet
It's not a secret anymore!