File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes difference between  getServletContext().setAttribute() and public data members in servlet class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "difference between  getServletContext().setAttribute() and public data members in servlet class?" Watch "difference between  getServletContext().setAttribute() and public data members in servlet class?" New topic
Author

difference between getServletContext().setAttribute() and public data members in servlet class?

Gautam Bhalla
Ranch Hand

Joined: Mar 31, 2013
Posts: 30

What is difference between getServletContext().setAttribute() and public data members in servlet classes?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12753
    
    5
The difference is the scope in which these variables are visible.

Bill
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60732
    
  65

And that public data members in the servlets will cause no end of threading issues and problems.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Consider Paul's rocket mass heater.
 
subject: difference between getServletContext().setAttribute() and public data members in servlet class?
 
Similar Threads
Servlet Calling Public Methods of Another Servlet
"application" and "getServeltContext"
Diffenrence between application and servletConfig - servletcontext
how to change values in servlet context
How to share a context (Struts and servlet)