Sorry, had some extraneous code in the example.  The block of code commeted 
"Hack to make the session replicate" should not have been there (it did not 
make the session replicate).  Below is the correct code.

Thanks,
Tom




<%@ page import="org.apache.commons.logging.Log" %>
  | <%@ page import="org.apache.commons.logging.LogFactory" %>
  | <%@ page import="java.util.Enumeration" %>
  | 
  | <% final Log logger = LogFactory.getLog("JSP Logger"); %>
  | 
  | <html>
  | Hit the start button to start the countdown.  Hit the stop button to stop 
the countdown.  Hit the dump button to print the http session state.  
  | <form action="/tlh/tlh.jsp?state=start" method=post>
  |   <input type=submit value="start">
  | </form>
  | <form action="/tlh/tlh.jsp?state=stop" method=post>
  |   <input type=submit value="stop">
  | </form>
  | <form action="/tlh/tlh.jsp?state=dump" method=post>
  |   <input type=submit value="dump">
  | </form>
  | <%
  |     String state = (String)request.getParameter("state");
  |     if (state == null) state = "stop";
  | 
  |     if (state.equals("dump")) {
  |       Enumeration enm = session.getAttributeNames();
  |       while(enm.hasMoreElements()) {
  |         String attr = (String)enm.nextElement();
  |         logger.error("*************** TEST SessionID=" + session.getId());
  |         logger.error("*************** TEST Session variable: " + attr + " 
value: " + session.getAttribute(attr));
  |       }
  |     } else {
  |       session.setAttribute("state", state);
  |       if (state.equals("start")) {
  |         if (session.getAttribute("cnt") == null) {
  |           session.setAttribute("cnt", new Integer(100000000));
  |         }
  | 
  |         int i = ((Integer)session.getAttribute("cnt")).intValue();
  |         while (i > 0) {
  |           logger.error("*************** TEST " + i);
  |           session.setAttribute("cnt", new Integer(--i));
  |           Thread.sleep(2000);
  |           if (((String)session.getAttribute("state")).equals("stop")) break;
  |         }
  |       }
  |     }
  | %>
  | </html>

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949513#3949513

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949513


_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to