- From: Manfred Knobloch <manne@diff.uni-tuebingen.de>
- Date: Tue, 2 Feb 1999 06:18:16 -0500 (EST)
- To: www-jigsaw@w3.org
Hi,
the following Servlet (sample from the o'reilly book) increments the
visit-counter on reload and works well with apache mod_jserv 0.9.11,
(apache + mod_jserv - ok)
http://chagall.diff.uni-tuebingen.de/servlet/SessionTracker
but does not increment its counter when accessed via jigsaw.
(jigsaw 2.0.1 - no incrementing)
http://chagall.diff.uni-tuebingen.de:8001/servlets/SessionTracker
Is there anything else to configure? I understood the documentation as the
servlets directory could be used to have Servelets automaticaly installed.
the code
--------------------------------------------------------------------------
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class SessionTracker extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
// Get the current session object, create one if necessary
HttpSession session = req.getSession(true);
Integer count = (Integer)session.getValue("tracker.count");
if (count == null)
count = new Integer(1);
else
count = new Integer(count.intValue() + 1);
session.putValue("tracker.count", count);
out.println("<HTML><HEAD><TITLE>SessionTracker</TITLE></HEAD>");
out.println("<BODY><H1>Session Tracking Demo</H1>");
out.println("You've visited this page " + count +
((count.intValue() == 1) ? " time." : " times."));
out.println("<P>");
out.println("<H2>Here is your session data:</H2>");
String nS = new String((session.isNew() ? "NEU" : "ALT"));
out.println("Session ist " + nS + "<BR>");
String[] names = session.getValueNames();
for (int i = 0; i < names.length; i++) {
out.println(names[i] + ": " + session.getValue(names[i]) + "<BR>");
}
out.println("</BODY></HTML>");
out.close();
}
}
------------------------------------------------------------------------
TIA
Manfred Knobloch
Kompetenzzentrum für Multimedia und Telematik
am DIFF
Konrad Adenauer Str. 40
72072 Tübingen
tel: ++49 (0)7071 / 979 232
fax: ++49 (0)7071 / 979 322
email: manfred_knobloch@diff.uni-tuebingen.de
Received on Tuesday, 2 February 1999 06:41:44 UTC