Struts2 and SPRINGMVC comparison 1

Source: Internet
Author: User
Tags commit comparison
In fact, all SSH is only one is struts2+spring3.0+hibernate, and the other is springmvc+spring3.0+hibernate, longitudinal comparison struts2 and SPRINGMVC can be,
First of all, the advantages of SPRINGMVC
1, based on annotations, stuts2 although there are annotations but relatively slow, no one use more time is in the form of XML
2, can integrate with other spring technology such as webflow, etc.
3, GET request and Session object is relatively simple, directly when the parameter value is passed, and Struts2 also need to get through the Servletactioncontext object
4, the verification is also relatively simple, through the jsr-303 can be achieved, without writing other code, and Struts2 is written actionname-validation.xml implementation of the
The advantages of saying struts2:
1, do not have to focus on whether the client is a get commit or a set commit, SPRINGMVC's address map annotation method is a must to be concerned
2, automatic packaging objects, SPRINGMVC, is encapsulated in the model can only be in, so you will see the input box number type has 0 or 0.0 options
3, custom result types, such as XML and SPRINGMVC can only return modelandview, or do not return
4, decoupling the view from the result, because Struts2 returns a string, only through struts.xml to know the specific JSP, or HTML, and SPRINGMVC can only explicitly return Modelandview
5,STRUTS2 does not require a special Chinese filter, and SPRINGMVC3 needs to be configured
They are much the same for labels, but when it comes to automatic assembly, the form form of the SPRINGMNC must be used, while the struts2 is not, and the other functions are similar, but efficiently, the SPRINGMVC label is faster than Struts2 because, Struts2 the heap and stack through request, so the efficiency is reduced, I recommend or use JSP tag not only easy to expand and, efficiency is good
Again application scenario: If all are successful after jumping a page of that both can, and if it is other type, then Struts2 is a good choice, for example, Extjs4.0 Add object Automatic assembly Struts2 can be achieved, but SPRINGMVC not, Unless you like a lot of request.getparamter ()

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.