struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: Please help clarify or confirm -- HttpSession
Date Thu, 13 Jun 2002 20:04:20 GMT

OK. I checked this out.

I'm running Tomcat 4.03 on NT with JDK 1.3.1.

I created a simple static class:
public class ClassLoaderTest {

    public static int counter;

    public static void addCounter() {

    public static String getCounter () {
        return Integer.toString(counter);

I compiled it and put the .class file in %CATALINA_HOME%\classes


I then created a simple jsp named "test.jsp"

<%@ page import="ClassLoaderTest" %>
    <title>Testing Class Loaders</title>
    <% ClassLoaderTest.addCounter(); %>
    <% out.print("Counter = " + ClassLoaderTest.getCounter() );  %>


I then created two webapps, "webapp1" and "webapp2".  They are completely empty except for
the test.jsp file and the following web.xml file:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"


  <!-- The Usual Welcome File List -->


Now - I then restarted Tomcat and opened two browsers. I pointed one to:


and the other to:


Then when I hit refresh on them I can see THEY ARE HITTING THE SAME OBJECT. That is, this
works. The counter increments each time I refresh either

Thanks for the thoughts on this Joe -


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message