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
What is the difference between Server and Container?
Define context initialization parameters.
How to create war file?
What is the purpose of dispatcherservlet properties?
Which application server is best for java?
How the servlet is loaded?
How can you create a session in servlet?
What are the objects involved when a servlet receives a call from client?
What is the difference between servlet and filter?
What is the difference between the include() and forward() methods?
Explain the role of dispatcherservlet and contextloaderlistener.
What do you mean by scope object and what are its types?
Which httpsession object is used to view and manipulate information about a session?
How can we refresh automatically when new data is entered into the database?
What exception should be thrown when servlet is not properly initialized?