Related concepts of java advanced foundation 00

xml, JavaWeb, Tomcat, Servlet, JavaEE three-tier architecture, MVC mode...Various commonly used concepts

1. XML

xml: Extensible markup language.

Main function :

  • Save data, and the data saved in xml is self-descriptive;
  • As the configuration file of the project or module;
  • As the format of network transmission data (less, now mainly json)

Syntax :

  • Document statement;
  • Labels, elements;
  • xml attributes;
  • xml comment
  • Text area

2. JavaWeb

JavaWeb : A program written in the Java language that can be accessed through a browser. Developed on request.

Request : The client sends data to the server.
Response : The server sends data back to the client.
Request and response generally appear in pairs.

3. Tomcat

Tomcat: A web server provided by the Apache organization that provides support for jsp and servlet. Tomcat is a lightweight and currently the most widely used javaweb container/server.

Other servers:

  • Jboss: The village is a JavaEE standardized, open source, pure Java EJB server that supports all JavaEE specifications.
  • GlassFish: A Java Web server and a commercial server developed by Oracle, which can reach the quality of production ratings.
  • Resin: CAUCHO's products provide good support for servlet and jsp, and have excellent performance. Only use java language for development (for a fee).
  • WebLogic: Oracle's product, currently the most widely used web server, supports javaEE specifications, and is constantly improving, suitable for large-scale projects (fees apply).

4. Servlet

Servlet:

  • One of the JavaEE specifications (interface);
  • One of the three major components of JavaWeb (Servelt program, Filter, Lisenter listener);
  • A small java program running on the server. Can receive the request sent by the client, and respond to the data to the client.

5. JavaEE three-tier architecture

  • Web layer (view presentation layer)
  1. Get the requested parameters and encapsulate them into Bean objects
  2. Call the Service layer to process business
  3. Response data to the client, request forwarding, redirection, etc.

Related technologies: Servlet program, SpringMVC framework

  • Service layer (business layer)
  1. Processing business logic
  2. Call the Dao layer to save to the database

Related technology: Spring framework

  • Dao layer (persistence layer)
  1. The Dao layer is only responsible for interacting with the database
  2. CRUD operations (Create add, Read read/search, Update modify, Delete delete)

Related technologies: JDBC connection database, Mybatis framework, DbUtils, JDBCTemplate...

Supplement: Layering is for decoupling, reducing code coupling, and facilitating later maintenance and upgrades.
Insert picture description here
Project structure

Floor structure Remarks
web layer com.ctgu.web (or servlet or controller)
service layer com.ctgu.service service interface package
service layer com.ctgu.service.impl service interface implementation class
dao persistence layer com.ctgu.dao dao interface package
dao persistence layer com.ctgu.dao.impl dao interface implementation class
bean entity object com.ctgu.entity (or pojo or bean or domain) javaBean entity class
Test package com.ctgu.test (or junit) test
Toolkit com.ctgu.utils

6. MVC mode

Insert picture description here
View : View layer. Used to display data and interact with users. Users view data and send data requests through the view layer.
Model : data access layer. Interact with the database to realize data access operations (CRUD addition, deletion, modification, and checking).
Controller : Control layer. Mainly achieve two tasks:

  • Process control (Controller)
  • Provide specific business processing (Service)

7. Commonly used databases

Mysql、Oracle、DB2、SqlServer

Understand the database access process

1. Load the driver class, use the Class.forName method
2. Get the database connection object, DriverManager.getConnection
3. Create the database operation execution object, Statement PreparedStatement
4. Execute the database operation
5. Process the returned data

To be continued

Guess you like

Origin blog.csdn.net/weixin_44836362/article/details/114547758