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


Please Help Members By Posting Answers For Below Questions

Describe the phases of servlet lifecycle?

840


What is the difference between sendredirect() and forward() in a servlet?

767


how to link html file to sevlet file.one name is textbox,c&c++ is cheakbox,bc&mca is radio button and one submit buttonis ok why in this programme use in servelt file

2361


Explain their methods? Tell me their parameter names also have you used threads in servlet?

821


What is called Scriptlet?

855


Which is better jsp or servlet?

794


What is difference between ServletResponse sendRedirect() and RequestDispatcher forward() method?

860


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?

1018


What is new in ServletRequest interface ? (Servlet 2.4)

813


How is the get () method different from the post() method?

761


What are the disadvantages of storing session state in cookies?

920


I Have A Plan to develop a Project in Struts,I want the template of struts project with Hibernate.Canany body provide me the required information?

2485


What do you mean by cgi and what are its drawbacks?

753


How are filters?

830


What if you need to span your transaction across multiple servlet invocations?

827