----- Original Message -----
From: Gustav Engdahl <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 21, 1999 2:23 AM
Subject: A few scope questions using Orion 0.76b...
> When using :<jsp:useBean id="sqldata" scope="application"
> class="dbquest.SqlAnsBean" /> on all our pages, only one instance of
> SqlAnsBean is seems to be created nomatter the amout of different people
> accessing the page.
This seems to me like the correct behavior for "application" scope.
> webbpages. The idea was that every "session" (NOT a session in jsp-terms)
> should use only one instance of the bean, i.e. for every person that would
> access the bean, the one and same object should be used, but if let's say
3
> persons are accessing the webserver at the same time, 3 different objects
> would handle the requests.
> What we desire is something in betweend the application and session
> alternatives. Any solutions or answers??
You could try using an object pool to hold your real (i.e. implementation)
beans and write a small bean that looks like your db access bean (probably
implementing the same interface) but when instantiated (via jsp:useBean)
actually makes a call to a static object pool to get an instance to delegate
all of it's functionality to. You would have to make sure somehow that the
bean was "released" (e.g. it's delegate put back into the pool) after you
were done with it. That would be easy for a bean that was allocated, used,
and released within the same page but more difficult if the release happens
on another page that the user might not get around to visiting. If you'd
like more help, post more details about the problem you're trying to solve.
> When using :<jsp:useBean id="sqldata" scope="session"
> class="dbquest.SqlAnsBean" />, the instance of SqlAnsBean seems to be lost
> when "jumping" from one jsp-page to another.
The problem you mentioned about the "session"-scoped bean being lost sounds
similar to a problem I had. Here's a message I posted to this list earlier
in answer to someone else :
------------------------------------------------------
I've seen this kind of thing happen when there's a difference in the way the
URL is specified. For example, if the user goes to
http://www.acme.com/loginservlet
and login servlet directs them to http://www.acme.com:80/main.jsp they'll
probably both be using different sessions (also if one of them is https and
the other is just http). This drove me nuts on a project I worked on and
took a while before I was able to figure out what the problem was. Could
this be what you're experiencing?
---------------------------------------------
Hope that helps,
Brien Voorhees
===========================================================================
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