Hello everybody!

I have Tomcat 4.x as Web Server and I would like to to the following two
things but I don't know how to do:

1) I need to share the same Servlet Context "MyContext" between
all the servlets and jsp-pages of my web application.

2) I would like that my web server does something when an event happens
in the servlet context "MyContext".

3) I would like to show to the user an html page of mine when a Tomcat's
error
happens (for example: "Page not found"). The problem is that I don't know
how to set Tomcat to do this.

I explain better the meaning of first two points:

The thing I would like to do is the following one: every time a user
connects to my servlet (or jsp-page) called "MyServlet" I create
a session (an HttpSession object). After creating it I put this session
in the MyServlet's Context (let's call it "MyContext"): in this
way I can count (using a counter "MyCounter" that I also insert in
"MyContext" together
with the user's session) the users connected to my web application.
All the servlets and jsp pages of my web application should share the
Context
"MyContext".

When I user disconnects from my web application I decrease "MyCounter" and
when "MyCounter" reaches the value 0 the web server Tomcat should execute
a java class (let's suppose it is called "MyClass") that does something (now
it is not important
to explain what it does). Instead when a user disconnects from my web
application
but the counter "MyCounter" doesn't reach the value 0 the Web Server Apache
should execute
another Java class (let's suppose it is called "MySecondClass").

All the other servlets and jsp-pages of my web application
can use the counter "MyCounter" to do some other checks: this is the reason
why I must
share the context "MyContext".

How can I set my Web Server Tomcat 4.x to do all this? What Java Servlet API
must I use?

Thank you very much everybody in advance (above all for the patience!).

Best regards,

                        Luca


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to