Hi,
ist ein wenig "Out Of Topic", da dies nichts tomcat-spezifisches ist.
Session-Tracking
Da gibt es verschiedene Methoden wie URL Rewriting oder Cookies oder noch
besser das Session Tracking API;
zur Verfuegung gestellt vom Servlet API. Genaue Docu dazu im entsprechenden
servletApi-Verzeichnis.
Basically recht einfach:
// nachstehender Code realisiert einen sessionbezogenen Counter
public void doGet(HttpServletRequest req, HttpServletResponse res) throws
.. {
// get the current session object, create one if necessary
HttpSession session = req.getSession(true);
// increment the hit count for this page and save it in the client's
session under the name "counter"
Integer count = (Integer)session.getValue("counter");
if (count == null)
count = new Integer(1);
else
count = new Integer(count.intValue()+1)
session.putValue("counter",count);
....
}
Note: Die Spez. des HttpSession-Objects wurde geandert - doch javac meldet
dies (-deprecation).
franzR
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, June 23, 2003 7:37 AM
To: [EMAIL PROTECTED]
Subject: How to access a specific session in a servlet
Hi list,
I am pretty newbie with servlets and I got stock now. How can I access a
specific session from Servlet?
Is this possible?
I need to do this because by a prevoius request I stored some objects in
the session which I need to access again later in other servlets.
I am running Tomcat 4.1.18
Any hints links are welcome and appreciated
Regards,
Christian Schuster
Rudolf Schuster AG
Postfach 277
CH - 3000 Bern 11
http://www.rsag.ch
++41 31 348 05 30
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]