|
My database access is all working
fine.
I just do not understand how to actually have
multiple instances of a bean accross multiple sessions. I was kinda hoping
that JSP & Beans would magically handle sessions (which it sort of does - a
unique cookie is given to each Browser on each PC).
Say, as an example, I have a Bean with the
following Methods:
(void) processRequest(HttpServletRequest
request)
This method does the database
work
(void) setCustomerIDNumber(int
IDNumber)
Allows the JSP page set the
Customer ID Number
(String) getCustomerFirstName()
Allows the JSP page get the
Customer's first name
So with the above Bean the JSP page could give (say
through a FORM textbox or hidden field) the Bean the Customer's ID number and
then get the Customers FirstName & display it within the page.
Now here's my problem:
If one JSP page - on one Browsers Window on one PC
sets the Customers ID number
and then
two Browsers - on two different PC's display the
Customer First Name via. the Bean then both Browsers will display the First Name
based on the ID number given by one Browser on one PC.
I do not actually have any unique sessions.
It seems that there is only one Bean and all JSP pages - viewed in different
browsers on different PCs share the contents of that one bean.
Do I have to include Session Handling code in the
Bean to allow for multiple sessions?
Thanks for any help as I cannot find information of
this in any JSP documentation.
The demo Beans which come with the JSP download
from SUN (such as the DummyCart Bean) do not have any session handling code
(and, in fact, the situation I am describing above also happens with the
DummyCart Bean).
I see that a lot of users on the JSP-INTEREST
mailing list seem to use Servlets and their output looks like a Bean to the JSP
code. I would rather the JSP Page <-- --> Bean module over calling
Servlets directly.
Derek :)
|
- Session Problems (cont) Derek Conniffe
- Re: Session Problems (cont) Derek Conniffe
- Re: Session Problems (cont) Hans Bergsten
