1. Why Java EE is required
The JSP code we write, because of a large number of display code and business logic is confused, nested with each other, is not conducive to the maintenance and extension of the program. When business requirements change, programmers and artists are a heavy burden.
for the ease of maintenance and scalability of the program, we need to use Java EE Technology for project development
2. What is Java EE
Java EE is a specification and standard for developing distributed enterprise-class applications.
The Java language platform has 3 versions: Javame for small devices and smart cards (Java Platform Micro Edition,java mini), Javase for desktop systems (Java Platform micro Edition, Java Standard Edition), the Java EE for enterprise applications (Platform Enterprise Edition,java Business Edition).
3, Java EE includes the technology
Java EE applications are composed of components. The Java EE component is a standalone unit that is assembled into a Java EE application through related classes and files and interacts with other components.
Java EE includes the following technologies: Web Service,Struts, Hibernate, Spring, JSP, Servlet, JSF, EJB, JavaBean, JDBC, JNDI, XML, Javase.
4. What frame
Framework is the framework, we can understand the frame as an application of semi-finished, is a set of components for users to choose, complete the user's own system. In short, use the components that others have prepared to implement your project.
5. The relationship between Java EE and framework
Framework technology is formed on the basis of Java EE, and the application is created on the basis of the framework.
6. Java EE architecture
The three-tier structure of the application is as follows:
Presentation layer: The code that consists of the user interface and the user-generated interface.
Middle tier: Contains the business and functional code for the system.
Data layer: Responsible for the completion of data access to the database and encapsulation of data.
Three-tier architecture benefits:
Changes to one component do not affect the other two components. For example, if a user needs to replace a database, only the data-tier component needs to modify the code. Similarly, if the user interface design is changed, only the presentation layer component needs to be modified.
Because the presentation layer and data layer are independent of each other, the presentation layer can be easily expanded, and the system has good extensibility.
Code duplication is reduced because the code is shared as much as possible between 3 components.
Good Division of labor and Cooperation. This will enable different teams to independently develop different parts of the application and give full play to their strengths and strengths.
7. Java EE Technical Content
Java EE technology architecture can be divided into: presentation layer technology, middle tier technology, data layer technology. Java EE also involves some technology of system integration.
7.1. Presentation Layer Technology
Html
Javascript
Ajax
Ajax is the integration of several technologies. The main function of Ajax is to send requests asynchronously to the server, process the data, or re-display the page based on the returned data.
7.2. Middle-tier technology
Jsp
A server page that displays dynamic content.
Servlet
A Java program that receives client requests and responds.
A servlet is an important part of a middle-tier technology that controls other components.
Jstl
The secondary JSP displays the standard tag library for dynamic content.
JavaBean
Model components for Java EE.
Framework technology of Middle layer
Struts framework: Struts primarily extends the servlet.
7.3. Data layer Technology
JDBC Technology
JDBC (Java database Connectivity): Java DB connection.
Use JDBC to manipulate tables and data in the database.
Data Layer Framework Technology
Data-tier framework, Hibernate provides the ability to manipulate relational database data in the form of objects.
7.4. System Integration Technology
In some large projects, the entire application is divided into several modules, developed synchronously by different development teams, it is possible that they use the technology is different, at the end of each functional module development, the thing to do is to integrate these fragmented modules into a whole, which is what we are customers want, This is where we need to use the technology for system integration (Web Service).
JAX-WS Technology
JAX-WS (Java API for XML Web Service) is an important part of the Java EE platform.
JAX-WS simplifies the work of developing Web services using Java technology.
Jndi
JNDI (Java naming and directory Interface,java naming and directory interfaces) is a set of APIs that access the naming and directory services in a Java application, and the naming service ties objects and names together and can find the appropriate objects by name.
8, HTTP (Hypertext Transfer Protocol, Hypertext Transfer Protocol) protocol
HTTP is a stateless protocol that is based on the client/server model. An HTTP client (such as a browser) needs to establish a connection with the server and send a request message over the connection to the HTTP server to request the appropriate resources. The server then returns a response message with the requested resource. When the response ends, the connection is disconnected and the connection information is not saved to each other. So HTTP is a stateless protocol.
HTTP uses ports to send and receive messages. A port is a channel or mechanism by which the Protocol sends and receives data. The 80 port is developed for HTTP and is used primarily for transmitting information on the WWW (World Wide Web) service. Browse Web Services The default port number is 80.
9, using the data monitoring tools provided by MyEclipse TCP/IP monitor for data monitoring.
Configuration steps for TCP/IP monitor (TCP/IP monitors):
Window--->preferences (preferences)--->run Debug (run/mode)--->TCP/IP Monitor (TCP/IP monitor)
Note: If not found, the following path is searched:
Window--->preferences (preferences)--->myeclipse---> Internet Tools (Internet tool)---> TCP/IP Monitor
Then check show the TCP/IP monitor view there is activity (display TCP/IP monitors to see when requests and responses are available).
Click the "Add" button to pop up the new monitor window.
Local monitoring Port: Fill in 8088. The native monitoring port, which is the port that monitor actually listens to.
Host name: Fill in localhost or 127.0.0.1. To monitor the host name, listen for the settings of the object.
Port: Fill in 8080. To monitor the port number, you want to listen to the port number, your request sent to the local monitoring port will go to this port.
Type: Select HTTP. The type to monitor.
timeout:0.
Click the OK button, and then click the Start button to start the monitor.
Then start Tomcat and enter: http://localhost:8088/the project name (or context path) in the Address bar. The TCP/IP monitor window appears in MyEclipse and you can see the data being monitored.
You can click the validatews-i Message log file icon (with a tick on the icon) in the upper-right corner of the window to add the log files.
An example of a request is analyzed below:
The message sent by the client is a text stream that consists of the following:
Request lines: Includes methods, Uniform Resource Identifiers (URLs), and HTTP protocol versions.
Header information: A typical request message resembles the following.
get/monitor/test.jsp?username=xinxin&userpassword=1234 http/1.1
host:localhost:8080
user-agent:mozilla/5.0 (Windows; U Window NT 5.1;ZH-CN;)
Accept:text/xml,application/xml, text/html; Text/plain;
The first line submits the request data using the Get method and specifies that the HTTP protocol 1.1 version is being used. Subsequent lines include header information, and the User-agent header indicates that the browser type used by the client is the Mozilla,accept header information that provides a list of MIME types that the client can accept. After the header information, the client sends a blank line indicating that the request message ends. The request message is processed further by the server and the corresponding response message is generated.
The following is an example of a response:
http/1.1 OK
Server:javawebserver
Last-modified:tuesday, 21-aug-07 11:12:10 GMT
content-length:100
Content-type:text/html
The first behavior status line. Status code 200 in the status line indicates that the request was processed successfully, so it is described as "OK", and 404 is the status code that was encountered when the requested Web page was not found. The other lines are header information, the server header specifies the software used on the server, the Last-modified header indicates the last modified date of the requested file, the Content-length header specifies the size of the file (in bytes), and the Content-type header specifies the MIME type of the document. For example, Text/plain indicates a text document that is not formatted. Text/html indicates a formatted Web document.
10. Get and Post sending methods
The Post:post method sends the contents of the form over HTTP, does not see the form's submission information in the address bar, is more secure, and uses post to send information with no limit to the length of the character.
Get mode: When the form content is encoded, it is sent via a URL and can be viewed in the address bar as unsafe. A 255-character limit is used when sending information using get mode. The GET Request page can be set as a bookmark or sent using mail, and post is not available.
Basic knowledge of Java EE