[Original]java Web learning note-MVC design pattern in 18:java EE

Source: Internet
Author: User

this blog is original: Integrated still Silicon Valley (http://www.atguigu.com) System tutorial (deep thank) and network of existing resources (blogs, documents, books, etc.), the source of resources I will markThe purpose of this blog: ① summary of their own learning process, equivalent to study notes ② to share their own experience to everyone, learn from each other, communication, not commercialcontent inevitably appear problems, welcome to correct, exchange, discussion, you can leave a message, can also be contacted by the following ways. I Internet technology enthusiasts, Internet technology enthusiastsWeibo: Ivan is in 0221qq:951226918

--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- -----------------------------

Components that are common in 1.javaEE development

1) commons-beanbtils: Handling Java Bean Packages

2) COMMONS-DBCP: Database connection Pool

3) COMOMS-DBUTILS:JDBC Operation data Sheet

4) Commons-fileupload: Upload and download files

5) Commons-logging: Log

6) Hibernate-release: Manipulate data tables in an object-oriented manner

7) JDPM: Workflow Flow

.......................

2.javaEE Development process

1) servlet mode:

Cons: ① show Trouble, servlet is not good at showing ② the code that operates the database cannot be reused

  

2) JSP mode:

Pros: Friendly display

Disadvantage: JSP access to the database code can not be reused, JSP has a large number of Java code (logic, access to the database), inconvenience to maintenance and upgrade

  

 3) MVC approach:MVC is the abbreviation of Model-view-controller, i.e. model-view-control

① Run Process: The client sends the request to the server, the server calls the servlet (Controller), receives the request, and, depending on the request, determines which method of the class is called.

Pojo contains processing logic, business logic, and access to the database. Results are processed. Returns the result to the servlet.

Servet to different JSP pages (forwarding mode, redirection mode) based on the returned results .

② Understand: MVC is a design pattern that divides an application into three core modules: models, views, and Controllers , each of which handles its own tasks.

③ Detailed Description:

I. Model (MODELS):(Database + POJO) Common Java class, and Access database

The > model is the main part of the application, and the model represents the business data and business logic;

> A model can provide data for multiple views;

> Because the code applied to the model can be reused by multiple views only once, it improves the reusability of the code.

Ii. view (view):(JSP page, standard tag library, EL, Struts2, SPINGMVC)

> View is the interface that the user sees and interacts with;

> view displays relevant data to the user;

> Accept user's input;

> does not perform any actual business processing.

III. Controller (Control):(servlet)

The > controller accepts the user's input and invokes the model and view to complete the user's needs ;

The > controller receives the request and decides which model component is called to process the request , and then decides which view to call to display the data returned by the model processing .

    

3. Summary

1) Re-understanding

2) Process of MVC

[Original]java Web learning note-MVC design pattern in 18:java EE

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.