single thread model

could you explain single thread model in jsp

difference between servlet and jsp
LVL 9
Manikandan ThiagarajanSenior consultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KruleCommented:
I could go into a long shpeil about the life cycle from different stand points, however I believe the authos do a great job themselves:

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro4.html
0
KruleCommented:
Oopsie, that was meant for another question, sorry about that.
0
TimYatesCommented:
In JSPs you can put:

    <%@ page isThreadSafe="false" %>

which makes it implement SingleThreadModel

As JSPs are converted to servlets by the container, there is no difference between the two...

And as a rule, DON'T use SingleThreadModel...  It is deprecated...  as it says in the API docs:

----------------------

Interface SingleThreadModel

Deprecated. As of Java Servlet API 2.4, with no direct replacement.

...

Note that SingleThreadModel does not solve all thread safety issues. For example, session attributes and static variables can still be accessed by multiple requests on multiple threads at the same time, even when SingleThreadModel servlets are used. It is recommended that a developer take other means to resolve those issues instead of implementing this interface, such as avoiding the usage of an instance variable or synchronizing the block of the code accessing those resources. This interface is deprecated in Servlet API version 2.4.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Manikandan ThiagarajanSenior consultantAuthor Commented:
Advantages of single thread model
0
TimYatesCommented:
don't use it

it doesn't work right
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.