Struts1 single case mode, struts2 non-single case mode

Source: Internet
Author: User

After years of training I have their own small web site free of lossless music site with SSH you can see the WWW 360ape.com

First of all, what is called the single case mode bar:

How to make a class in Java, can only instantiate once. The
answer is: Single case mode.

the specific code is reflected in the public
class a{
    Private A () {}//The constructor to private, other classes can no longer invoke the instantiated
    Private static A Instance=new a ()//unique instance, plus static property
    public static A getinstance () {//Other class calls the unique entry of a, also the static property, called by A.getinstance ()
        return instance;
    }
}
"The Struts1 action is a singleton pattern and must be thread-safe because only one instance of the action handles all requests." A single example strategy limits what Struts1 action can do, and is particularly cautious when developing. The action resource must be thread safe or synchronized. 

Action execution Control: "STRUTS1 supports a separate request processors (lifecycle) for each module, but all the action in the module must share the same life cycle." "STRUTS2 supports creating a different lifecycle for each action through the Interceptor Stack (Interceptor Stacks). The stack can be used in conjunction with different action as needed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.