Yvonne: If I understand your question correctly - you don't quite get how a
web server (container) works.

In a JSP container you will get one instance of a variable or object per
session.  Now each of these objects may be used in more than one session BUT
no one object will be used by more than one session at a time.  Usually your
JSP container will handle the objects and which sessions are using them and
pool them when they are not in use.  You don't have to manage that manually.
Also if you have values that need to be persisted over a users session you
will need to set up a mechanism to maintain this information (either session
level persistence or writing to a DB - whatever is best for your app).  Data
in web apps does not necessarily persist from one page to the next unless
you code that into your web app.  Issues like this are kind of the back bone
of how web apps work and should be covered in most basic JSP or web design
books.  You might want to try to pick up a good one and check out the
beginning chapters.

Web apps are very different from traditional apps and you should probably do
some research into how the really work before you head off into the sunset.

Cheers, Janet


-----Original Message-----
From: Yvonne Meinken [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 19, 2001 8:20 AM
To: [EMAIL PROTECTED]
Subject: Re: Singleton per Session


What do you mean with 'local scope'? There are multiple clients that share
simultaneously the same application, which is execute on one web-server.
If we use Java applications as clients, every user gets his own local
singleton-instance, that manage user-specific settings. In connection with
JSP
there would be instanciated one instance per web-server, that is shared by
multiple
sessions (users), isnt't it?

Joseph Ottinger wrote:

> >I want to use the singleton-pattern in my application but when JSP-pages
> >serve as clients, every session should use it's own instance of the
> >singleton. How can I manage?
>
> Put the singleton in local scope for the application.
>
> >It is possible (how?) to start a new JVM for every new session? - I'm
> >using the Borland Application Server with Tomcat.
>
> YIKES! I shudder to even THINK about this...
>
> You don't need to, you don't want to, unless Tomcat's far more broken than
I
> thought. Classes are local to each application; if your singleton is
located
> in WEB-INF/classes, for example, they exist only for that application
> (although CLASSPATH rules still apply.)
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> 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

--
Yvonne Meinken
Werum DV-Systeme GmbH
Erbstorfer Landstr. 12
D-21337 Lüneburg
Tel.: +49 4131 8900-25
Fax: +49 4131 8900-20
mailto:[EMAIL PROTECTED]
http:\\www.werum.de

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
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".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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