Q:

How does jsp ensure thread safety?

When multiple threads are accessing the same servlet instance,how is it possible that we get expected results always.Since when one thread starts exceuting,it can set some value to instance variable that a different running thread can access.
There in no lock on object.
Can anybody throw some light how it is happening and we are getting expected results each time??
Thanks in advance

A:

JSP will not ensure thread safety by the technology. You must code the threadsafety in the JSP yourself.
Sometimes the container implements thread-safety under special conditions, by technology: if one port for only one request without multiplex and without portredirection.

