MVC design Pattern

Source: Internet
Author: User

MVC design Pattern
Model View Controller
Model: Represents business data and business logic < databases and pojo>
View: The interface that the user sees and interacts with
Controller: Accept user input and invoke model and view to complete user's needs
< accepts 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 >
MVC Case < No business layer and transactional operations >
Technical JSP, Servlet used
Database using MySQL
Connecting the database using the C3PO database connection pool
The JDBC tool uses Dbutils
Prompt action on the page using JQuery
Technical difficulties:
How multiple requests use a servlet
Fuzzy query
Verify that the user name exists in the case of creation or modification and give a hint
function of view-->jsp
1) Rendering data
2) Accept the user's input
3) write the JS code to give the corresponding hints
The function of controller-->servlet
1) Get request information: GET request parameters
2) Verify the validity of the request parameters: validation failed, need to return to page, and give the prompt information
3) package The request parameters as a JavaBean
4) Call the DAO method to get the returned result
5) Put the returned results in the request
6) Response page: Forward, redirect
function of Model-->dao
1) Get Data connection database
2) Perform CRUD operations
3) return results
MySQL Database
< Jsp-->servlet-->dao-->mysql
-->dao-->servlet-->jsp >
Attention:
1) cannot be accessed across tiers!
2) can only be dependent on the upper and lower, but not from the bottom up dependent < as the servlet relies on the DAO in the Dao,servlet interface, but DAO can not have the interface of the servlet, this is a mess >
Development sequence: Database----------and JSP, servlet

MVC design Pattern

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.