The concept of J2EE and the understanding of the MVC architecture

xiaoxiao2021-03-06  88

I recently watched some JSP-related books, and I wouldn't involve some J2EE content, and write some things record.

J2EE

It is a design environment and framework specification that can be created to create distributed, component-based, multi-layer server applications. It provides a running base framework and creation application

Java

Expand

API. The extended API and its meaning of J2EE: JavaServer Pages (JSP)

Mainly used to generate dynamic web content, add Java program clips and JSP tags to the traditional web page, and make up the JSP page. It is a request to receive a client on the server side, execute the program clip, and then perform the execution result in an HTML format to give the client. The executed program segment can be: actions or redirect web pages.

Java servlets

Servlet technology is earlier than JSP technology, it is better than a small Web Server. Servlet API is specially designed to help Java developers create dynamic applications, but their output webpage is more complicated.

However, JSP is well combined with servlet, forming a representation of the J2EE web application, while other technologies (eg, enterprise JavaBean, EJB) constitute logic and data layers.

Enterprise JavaBean (EJB)

EJB is an important component in J2EE, which is a framework that can be used to create server-side components applied to application servers. JavaBean developers can use EJB without worrying about some features of the system level, such as security issues, things, etc., because supporting J2EE's application servers must provide such features. So JavaBean developers can focus on writing JavaBeans.

Java Naming and Directory Interface (JNDI)

JavaMail

Java Message Service (JMS)

Java Transaction API (JTA)

Javaidl

JDBC

JDBC is to enable Java applications to get data from the relational database and store data provided to the relational database. With JDBC API, you can use the same syntax access to different relational databases.

Some of them explained, because they will be used, others may not be used temporarily.

Because it is usually used in general development systems.

JSP

with

Servlet

,

Javabean (including EJB)

,

JDBC. Also want to say that MVC is MVC.

Developing applications with Java, usually can be divided into two design modes of Model1 and Model2.

Because JSP is very simple, it is called Model1 in JSP-centric design model. This approach can also be divided into two (described later), one is to develop using JSP, and the other is to develop using JSP JavaBean.

A commonly known model2 is a development model using the MVC architecture. The abbreviation of MVC is Model-View-Controller. Model represents the business logic of the application (implemented by components such as JavaBean, EJB), and View is the system's display layer (using JSP output HTML), and the controller is a process control (usually servlet). The MVC is not a new concept. In the 1980s, this concept was started to design applications, and the popularity of the network made this design pattern more perfect.

Model1 The first: purely using JSP development systems When a user sends a request to the server, it is received and processed by JSP, then executes the result and responds to the client.

Browser

Browser

Client

(Client)

JSP

request

REQUEST

response

Response

Service-Terminal

(Server)

There are many shortcomings in this manner, and the program readability is very low because the program code is mixed with the web tag, and the extent of the maintenance is added; the repeated use of the program is low, and many of the different JSP files are found. Program code, when the business logic modifies, you need to modify all related JSP files.

Second: Using the JSP JavaBean development system Using the JavaBean package to encapsulate some reusable components. When the client sends a request, the JavaBean is called by JSP to call the relevant data access, logical operation, and finally return the result back to the JSP display result. . In this way, the program code is implemented with JavaBean without increasing readability, but also adds performance of repeated utilization. However, this method lacks process control, which causes each JSP to verify the correctness of the request, confirming the user's identity permissions, and abnormal processing.

Model2 commonly known as Model2 is the development model of the MVC architecture. In this way, the development process is more clear, adding the Controller control process, reducing the Conditional judgment of the JSP writing too much logic, and the entire system also makes it easy to maintain and expand.

转载请注明原文地址:https://www.9cbs.com/read-98331.html

New Post(0)