Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Java Servlets
Expertise: Beginner
Oct 10, 2000



Application Security Testing: An Integral Part of DevOps

Servlet Variables

If I declare one variable in a servlet class, and if I create many instances of that servlet, what will be the status of that variable?

If the variable is not static, there will be separate instances of that variable in each servlet and the value of the variable in one instance will not be reflected in another. If the variable is static, it will be shared by all servlets running in the same servlet container that were loaded by the same class loader. In general, it is a bad idea to use static variables to share information between multiple instances of the same servlet.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date