can servlet have instance variables?
Answer Posted / rajashree
The servlet you write can be used simulataneously by many
users at the same time and each user of the servlet has a
thread. Consider the user and the session one and the same.
Avoid instance variables. An instance variable is any
object owned by a a class. There will be only one of these
per class - not one per user. In general, you can not have
a user modify an instance variable because other users are
also using the same variable.
Is This Answer Correct ? | 35 Yes | 5 No |
Post New Answer View All Answers
How can we refresh automatically when new data is entered into the database?
What are the types of Session Tracking ?
Why is httpservlet declared abstract?
Explain web container.
Is dispatcher servlet a singleton?
How is a servlet implemented in code?
How do you design microservices?
Can you send an authentication error from a servlet?
What is getservletcontext?
Once the destroy() method is called by the container, will the servlet be immediately destroyed? What happens to the tasks(threads) that the servlet might be executing at that time?
Explain the working of service() method of a servlet.
What does the term localization refer to?
How can we refresh automatically when new data has entered the database?
When Servlet is unloaded?
What are the life cycle methods of the servlet?