hi rajesh
actually for each request coming to sever, the server calls the service
method(doGet or doPost) every time. and all class object will be created
once when the servlet is getting instantiated for the first time. so may be
you have defined your vector object at class level and there is only one
copy of the vector .
for your problem defining the vector in the service method is not the
solution because every time a request is being served the service method
ends and hence all var. inside it .
i think what you can do is store the vector object in some hash table or
temp. file with the session id and retrieve the same when requested for.
inform me if you get some better solutions,
Rahul
"Save, Rajesh (CAP, CARD)" <[EMAIL PROTECTED]> on 10/15/99 04:40:16
AM
Please respond to "Save, Rajesh (CAP, CARD)" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: Rahul Dwivedi/LTITLVSH)
Subject: Sessions ?
Hi,
Can someone explain how the multiple (concurrent) requests are handled
by the Web-server/Servlet-engine with regards to Servlet/JSP/JavaBeans
?
My environment: HP-UX, JRun 2.3.3 (Build-154) as Web server & Servlet
engine.
I have a simple application where a single Servlet is called repeatedly to
(first) query the database and
then to display the results one record at a time. (Bad design ? well, it
was my first app.)
This Servlet makes the Database query and stores records into a Vector,
which are then displayed (one at a time) on successive invocations
depending upon the "Next|Prev" buttons.
I would obviously like each user to be able to make his own query and see
his private results.
If I run this Servlet from one browser and then from another (browser) on
different machine,
I see the same data that is being displayed to the first user. This shows
there is only one instance of Servlet object.
I have NOT used sessions. I believe Sessions are supposed to help here. But
how ?
Do I have to create different Vector per Session-ID or one Servlet object
gets created per session ?
How does it work when I have JSP and JavaBeans ?
How many JavaBeans (objects) are created when I <jsp:useBean /> a JavaBean
at a Request/Session/Application scope ?
I haven't seen ANY talk about it in all the discussion that goes on here or
in any of the examples on the web either.
Is this a no-issue ?
Thanks,
- Rajesh
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html