Java – MVC architecture for working with servlets
So, yes, that's my understanding
>Servlet is just an intermediary, which is responsible for finding out the meaning of parameters in the request These parameters will be provided to Java file It's just a middleman The java file is the model that executes the business logic, and the view is the JSP that will execute the presentation
Did I do it right?
Solution
The model view controller pattern is not specific to Java or Servlet Technology There are many non Java MVC implementations, and in Java, there are non servlet implementations (swing is an example)
In Java, MVC framework is usually used when MVC based on servlet is used There are two main categories: action based and component-based. The difference is that the behavior-based framework listens to each registered URL independently, while the component-based framework retains the component tree and maintains the server-side state
The action - based frameworks are spring MVC, struts 12, stripes, play, etc The component-based framework is wicket, JSF 1 & 2, tapestry, etc
Your chart is close to the facts, but there are some subtle misunderstandings
First, talk about Java files are meaningless The Java source file has nothing to do with the deployed web application. It uses only compiled Class file, and Java VM can be written in many different languages, so applications don't care Is the class file compiled from Java? Scala can use groovy, jruby, clojure, AspectJ or anything else as long as it complies with the Java class file specification
Secondly, although JSP has always been the default view technology in java servlet technology, it is far from unique Other technologies include facelets, velocity, FreeMarker, etc. if there is no special view technology, nothing can prevent you from writing data directly to the controller (although this is usually undesirable)
Basically, MVC represents a system in which there are separate business logic code (m), view technology (V) and controller connecting things In a well-organized MVC architecture, part m is well encapsulated so that the same business logic can also be executed through other channels (e.g., web services, direct library access, etc.) In addition, it should be possible to switch view technology externally through configuration without editing the actual controller logic
I suggest you read the docs for the spring MVC framework. As far as I know, it is the most powerful (and easy to use) MVC framework with great tool support (in intelij idea or springsource tool suite based on eclipse)