It seems to me that it doesn't matter much if a method of a servlet is
static or non-static. The servlet engine will use the same instance of
the class to handle all requests anyway. Am I wrong?
I know there are some subtle situations where you might have more than
one instance running because of dymaic reloading. And of course static
methods can't use non-static data. But since I don't keep any
non-static data in my servlets these are not problems. I often use
static methods like this (simplified code):
public class MyServlet {
public void doGet(req, res) {
result = performService(req, res);
out.println(result);
}
public static performService(req, res) {
// whatever
}
}
This gives other servlets access to the same services simply by calling
MyServlet.performService(). This saves me from messing with
getServlet(). Are there any syncronization issues invloved here or any
other problems I'm not aware of?
Thomas Oldervoll
System developer, University of Bergen
___________________________________________________________________________
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