single thread model

Posted on 2006-05-20
Last Modified: 2010-04-01
could you explain single thread model in jsp

difference between servlet and jsp
Question by:stmani2005
    LVL 3

    Expert Comment

    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:
    LVL 3

    Expert Comment

    Oopsie, that was meant for another question, sorry about that.
    LVL 35

    Accepted Solution

    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.
    LVL 8

    Author Comment

    Advantages of single thread model
    LVL 35

    Expert Comment

    don't use it

    it doesn't work right

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    unit test DAO layer 1 132
    J2SE 5.0 metadata 1 40
    build fail in maven project 11 160
    How to Post an If Statement in JSP 3 39
    The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
    DECT technology has become a popular standard for wireless voice communication. DECT devices are not likely to be affected by other electronic devices and signals because they operate in a separate frequency-band.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now