Passing data between two servlets
843840Nov 20 2002 — edited Nov 21 2002Hi,
I am a newbie to sevlet programming. I am developing an HTML page with many frames. Each frame will contain a different servlet. The first servlet on the frame calls an object "QueryDB" which queries a database and stores that information into a datastructure.
What i am trying to do is have that primary servlet pass the data queried from the database to the other servlets on the html page, in order to minimize on the time required to query the database. I am kinda stuck on how this could be possible. I have tried to attach my object qdb of type QueryDB using:
getServletConfig().getServletContext().setAttribute("ID", qdb)
as seen on the following post.
http://forum.java.sun.com/thread.jsp?forum=31&thread=200730
when i use the getAtribute() method the servlet does not work correctly. The qdb object has the datastructure which i would like to pass to the other servlets, and when i try to have my servlet output this data, the servlet fails.
Any insight or other suggestions for this problem would be greatly appreciated!
Thanks,
Nirbhay