The whole point of session scope is that there is one object per session
that persists and is accessible from different JSPs. There are a number of
possible explanations for the results you saw, of getting different objects.
One possibility is that your testing involved accessing the JSP from
different clients, in which case each client gets its own session object;
this is the definition of session, and things are working the way they
should. If your testing involved accessing the JSPs from the same client,
then possibly you have cookies disabled on that browser. The session
mechanism uses cookies to track the sessions. If they are disabled, the
server will usually try to use URL-rewriting, but that only works if you
pass all your links through response.encodeURL. Another possiblity is that
session tracking is not enabled in the web server; I think some servers have
a config option to turn that on or off. If none of those are true, then it's
gremlins in your server :-).

--Jim Preston


-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Howard Lee
Sent: Thursday, July 13, 2000 2:53 PM
To: [EMAIL PROTECTED]
Subject: question about <useBean scope>


Hi guys,

I have a question about <jsp:useBean>. I have two separate JSP files that
instantiates (by doing <jsp:useBean>) this bean in each file. The scope of
the bean is session. My question is does JSP engine create one object and
share it with these two JSP files or one for each? From the testing code I
ran, it seems like it's creating separate objects. Is there a way to just
create one object and have different JSP files share that object without
using session? (e.g. I was storing that bean in session and each JSP files
just grabs it out of the session.) Thank you very much for any
help/suggestions.

howard

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to