1. Mechanism :spring mvc The entrance to is servlet, and struts2 yes filter, This leads to the different mechanism of the two .

2. performance :spring A little bit struts fast .spring
mvc It's a method based design , and sturts It's based on classes , Every time a request is sent, there will be an instance action, Every action Will be injected with attributes , and spring Method based ,
Finer particle size , But be careful. It's like servlet Control data is the same .spring3
mvc It's method level interception , After intercepting the method, according to the annotation on the parameter , hold request Data injection in , stay spring3
mvc in , One method corresponds to one request Context . and struts2 Framework is class level interception , Create a... Every time a request comes Action, And then call setter
getter Method to request Data injection in ;struts2 In fact, by setter
getter Methods and request Dealing with ;struts2 in , One Action Object corresponds to a request Context .

3. Parameter passing :struts When accepting parameters , You can use properties to accept parameters , This means that parameters are shared by multiple methods .

4. Design ideas :struts More in line with oop Programming ideas , spring More cautious , stay servlet Expand up .

5. intercepter Implementation mechanism :struts Have your own interceptor Mechanism ,spring
mvc It's independent AOP The way . This leads to struts The number of configuration files is still larger than spring
mvc Big , although struts The configuration of can inherit , So I think in terms of use ,spring mvc Use more succinctly , Development efficiency Spring
MVC Do than struts2 high .spring
mvc It's method level interception , One method corresponds to one request Context , And the method is the same as url Corresponding , So from the architecture itself spring3
mvc It's easy to achieve restful url.struts2 It's class level interception , A class corresponds to a request Context ; Realization restful
url It's going to take a lot of effort , because struts2
action A method of can correspond to a url; Its class properties are shared by all methods , This makes it impossible to annotate or otherwise identify the method to which it belongs .spring3
mvc The methods are basically independent of each other , exclusive request
response data , The request data is obtained by parameters , Processing result passed ModelMap No variables are shared between methods that are handed back to the framework , and struts2 It's a mess , Although between methods
It's also independent , But all of it Action Variables are shared , This will not affect the program running , But code us , Trouble reading the program .

6. in addition ,spring3 mvc It's also a bright spot , Support JSR303, Handle ajax Your request is more convenient , Just one comment @ResponseBody , Then directly return the response text .

Spring MVC And Struts2 More articles about the difference between

  1. Spring MVC and Struts2 The difference between

    1. Mechanism :spring mvc The entrance to is servlet, and struts2 yes filter, This leads to the different mechanism of the two . 2. performance :spring A little bit struts fast .spring mvc It's a method based design ...

  2. Spring MVC and Struts2 The difference between ?

    1. Request blocking level struts2 Framework is class level interception , Create a... Every time a request comes Action, And then call setter getter Method to request Data injection in struts2 In fact, by setter ge ...

  3. Spring MVC and Struts2 The advantages of comparison

    Spring MVC and Struts2 The difference between : Mechanism :spring mvc The entrance to is servlet, and struts2 yes filter( Here it should be pointed out ,filter and servlet Is different . Previously considered filter yes ...

  4. Spring MVC and Struts2 contrast

    Spring MVC and Struts2 The difference between : 1. Mechanism :spring mvc The entrance to is servlet, and struts2 yes filter, This leads to the different mechanism of the two . ​2. performance :spring A little bit s ...

  5. Spring MVC and Struts2 Comparison

    Spring MVC PK Struts2 We use it struts2 The traditional way of configuration file is adopted in the process of configuration , Not using the legendary 0 To configure .spring3 mvc It can be thought that 100% Zero configuration ( In addition to the configuration spring mvc ...

  6. Spring MVC and Struts2 Comparison [ turn ]

    Although there is no systematic study Spring MVC frame , But working so long , Basically, in WEB Layers use Spring MVC, I feel Struts2 It's also a good one WEB Layer framework , These two frameworks have not been compared yet ...

  7. Spring、Spring MVC、Struts2 Advantages and disadvantages

    Spring And its advantages Most projects have Spring The figure of , Why do people like him so much , And there is no decline in his popularity Spring What is it? : Spring It's a lightweight DI and AOP Container frame . It's light weight ...

  8. Spring、Spring MVC、Struts2、、 Advantages and disadvantages ( turn )

    Spring And its advantages Most projects have spring The figure of , Why do people like him so much , And there is no decline in his popularity Spring What is it? : Spring It's a lightweight DI and AOP Container frame . It's light weight ...

  9. spring MVC And struts The difference between

    When it comes to the primary framework, the purpose is simple ---springmvc Support rest, Xiaosheng is right restful url I really like You don't need to know that development efficiency is higher than struts2 high We use it struts2 The traditional configuration file used in the design ...

Random recommendation

  1. Write a C# Command line parameter parsing tool

    Recently, we have done a lot of testing work, so we often need to create some console type applications . Because the program has different parameter switches , Need to start the program through the command line to pass a variety of switches and parameters to the program . Direct manipulation args Some inconveniences , So I wrote a small worker to analyze the parameters ...

  2. use pxe start-up iso On the CD pe

    use pxe start-up iso On the CD pe I'm not an operator , therefore pxe I can't because of an old notebook u Disk start . The CD-ROM is broken again , The system on the hard disk was accidentally dropped by me ...ghostexp decompression ghost File to c At the time of the dish ,c Plate is ...

  3. MVC5_ Learning notes _1_CodeFirst

    MVC5_EF6_1/* GitHub stylesheet for MarkdownPad (http://markdownpad.com) *//* Author: Nicolas Hery - ...

  4. IOS edition UC My video address

    UC browser /Library/Application Support/offlineVideos

  5. C# Verification Code

    using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; us ...

  6. [tools] sublime Use records

    1. Text search function under the directory ( Bring their own ) 1). Drag the folder to sublime On 2). stay sublime Expand the directory to search on , Right click , choice [find in folder] 2. sublime cons ...

  7. Jquery radio checked

    Jquery radio checked     radio 1. $("input[name='radio_name'][checked]").val(); // Choose to be selected Rad ...

  8. stl Source code analysis : Compiler's advanced definition location set settings

    At the moment, my working environment is still win. All demos also use VS perhaps cygwin These environments are the foundation . 1. Additional configuration items include Objective , Add pre defined location set settings , The compiler will add it include route , For example, define a ...

  9. java Memory analysis summary

    1. Self contained jconsole Tools . (1) Suppose you start from the command line , send JDK stay PATH On , perform jconsole Can . (2) Assuming that the GUI shell start-up , find JDK The installation path , open bin ...

  10. Java Learning notes 11( Object oriented four : polymorphic )

    polymorphic : give an example : Describe the various forms of a thing , Such as Student Class inherited Person class , One Student The object is Student, again Person Polymorphism is embodied in : A parent class reference variable can point to a child class object The premise of polymorphism : There has to be a son ...