Can we use a static object to share it between
servlets ?
  Under ServletExec (NT, IIS) in folowing example
"writer" and "reader" servlet see different JJJ :
------- static JJJ
--------------------------------public class c{
  public static int JJJ = 0;
}
---------- writer -------------------------------
public class writer extends HttpServlet {
  public void service (HttpServletRequest req,
  HttpServletResponse res)
  throws ServletException, IOException {
    PrintWriter out = res.getWriter();
    res.setContentType("text/html");
    out.println("jjj = "+(++c.JJJ)); // !!! changing
    out.close();
  }
}
------------ reader -----------------------------
public class reader extends HttpServlet {
  public void service (HttpServletRequest req,
  HttpServletResponse res)
  throws ServletException, IOException {
    PrintWriter out = res.getWriter();
    res.setContentType("text/html");
    out.println("jjj = "+c.JJJ);
    out.close();
  }
}

================================================
The point is  - it does work under servletrunner(JSDK).
Writer and reader have the same JJJ value.

  What do guys from newAtlanta can say about ?
Do we have a way to share a static variable under
ServletExec ?
  Regards. Alex. Wired Solutiuons. Toronto.



_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to