Spring MVC Basics

Source: Internet
Author: User

Spring MVC Basics

 

1. What is the 1.1 web MVC design pattern?

The Framework Design Concept controls the business logic and pages accordingly, and separates client requests from database processing,

The structure is clear and clear, making the code easier to modify and manage.

M-model

Business logic layer

V-view

Business presentation layer

C-controller

Control layer, you want to implement the function here write some column class to implement the function;

 

1.2 use java to implement a lightweight web Framework of the request-driven type in the web mvc design mode

In the original web c-s (in the customer-server mode, the controller and model are added,

The commonly used web server is TOMCAT

Http://sishuok.com/forum/blogPost/list/5160.html

2. Spring framework 2.1 The spring framework module Spring framework is a layered architecture consisting of seven well-defined modules. The Spring module is built on the core container. The core container defines how to create, configure, and manage beans.
Each module (or component) that makes up the Spring framework can exist independently or be implemented together with one or more modules.

Reprinted from the http://www.ibm.com/developerworks/cn/java/wa-spring1/ from the light to the deep understanding of spring framework http://developer.51cto.com/art/201006/205212_all.htm

2.2 spring framework Model, ModelAndView, ModelMap and other differences in detail visible http://www.cnblogs.com/google4y/p/3421017.html

Http://itroop.iteye.com/blog/263845

2.3 reflection mechanisms in Spring are the basis of most frameworks. Reflection mechanisms are used to parse java classes, interfaces, methods, attributes, and other elements to facilitate understanding of JVM running mechanisms. class file, load the Class Object of the class, and then use it to create all objects of the Class, obtain information about the class through these objects, and then use java. lang. the following programming example shows how to use APIs in the reflect package to meet various dynamic requirements:

 

Package myprojcet1; import java. lang. reflect. field; class Student {String name; int age; // No parameter constructor public Student () {super (); System. out. println (success !);} Public Student (String name, int age) {super (); this. name = name; this. age = age; System. out. println (this. age is: + this. age) ;}} public class ReflectNewInstance {public static void main (String [] args) throws Exception {Class
 
  
Clastu1 = Student. class; // get the class object, field class Student obj = clastu1.newInstance (); System. out. println (obj); // use the constructor with parameters in java. lang. reflect. constructor
  
   
Constu1 = clastu1.getConstructor (String. class, int. class); Student stu1 = constu1.newInstance (zhangsan, 30); System. out. println (obj); Student stu2 = constu1.newInstance (liming, 18); System. out. println (stu2.getClass (). equals (stu1.getClass (); System. out. println (stu2.getClass (). equals (obj. getClass (); System. out. println (stu1.name. compareTo (stu2.name) + is bigger); System. out. println (stu1.age + stu2.age is + stu1.age + stu2.age); // call a common comparison method defined by reflection, System. out. println (compare (stu1, stu2 ). name + is bigger);} public static Student compare (Student stu1, Student stu2) {try {Field field = stu1.getClass (). getDeclaredField (age); field = Student. class. getDeclaredField (age); int val1 = (Integer) field. get (stu1); int val2 = (Integer) field. get (stu2); if (val1> val2) {return stu1;} else {return stu2 ;}} catch (Exception e) {// TODO: handle has tione. printStackTrace ();} return null ;}}
  
 


 

Http://www.blogjava.net/Todd/archive/2010/04/22/295112.html

The ease of use of Spring MVC framework is that you can define the input parameters of the Request Processing Method in any order (except that Errors and BindingResult must be followed by the command object/form parameters ), spring MVC automatically transmits the corresponding object to the request processing method through the input parameter based on the reflection mechanism. This mechanism allows developers to develop control layer programs without relying on Servlet APIs. When request processing methods require specific objects, they only need to declare input parameters in the parameter list, without thinking about how to obtain these objects, Spring MVC framework is like a big manager who "worked hard" to prepare everything we needed.

Https://www.ibm.com/developerworks/cn/java/j-lo-spring25-mvc/

 

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.