JavaWeb learning summary (final summary)

JavaWeb learning summary

        This semester's JavaWeb course has a lot of class hours, which are divided into two parts: theory class and experiment class. The learning process is quite rough, mainly because the principles of related technologies are obscure and difficult to understand. Before that, I also had a certain understanding of Web-related technologies. I started to learn Web development technology when I was a freshman. I have been learning Web front-end until the second semester of my sophomore year. I started to learn Web back-end technology in the second semester of my sophomore year. JavaWeb is the starting point for me to learn back-end development. Therefore, I study JavaWeb very seriously. From reviewing the basics of web design and java at the beginning, to starting MySQL, JDBC, Servlet, JSP from scratch, and then to MyBatis, Spring, and SpringMVC, I have studied every technical point seriously. Principle, spent a lot of time, it can be said that this semester I spent most of my class time learning web back-end technology. According to my plan for myself, I originally planned to start learning the web backend this semester. It happened that I started the JavaWeb course this semester. The overlap of the two also made the process of learning web development much easier for me.

       I mostly learn the theoretical knowledge of this semester through reference books, matching textbooks and online teaching videos. While learning the theory, I also did a lot of exercises to deepen my understanding. I basically completed all the experiments in this semester through my own understanding and logical thinking, and then optimized them with the teaching materials. Before again, I also thought about why I should learn JavaWeb. During this semester I found out. First of all, JavaWeb is definitely one of the reasons for this semester's course, but it is not the main reason. Before learning back-end development, I also saw a lot of discussions on the Internet about whether JavaWeb is worth learning. I used to be very entangled, because many people said that JavaWeb has long been outdated, and it is not as fast as learning emerging frameworks. Some people say learning JavaWeb is helpful for later development. In the end, according to my own situation, I chose to learn JavaWeb and study it seriously, because I think I am only a sophomore now. What I need is not to cope with work, but to understand, understand the implementation principles of these technologies, and understand the project The operation process, and personally practice. This semester has benefited a lot from web development. I have summarized the emergence, principles, characteristics, advantages and applications of JavaWeb-related technical points, which can be roughly divided into the following points:

 1. Basics of web design (HTML, CSS, JavaScript, Bootstrap)

        HTML, CSS, and JavaScript are mainly used to build the front page of the Web project, that is, the part that interacts with the user, responsible for obtaining the user's request information and displaying the server's response data. Nowadays, there are many front-end frameworks that replace the previous handwritten HTML and CSS. The highly integrated framework greatly improves the efficiency of front-end development. Bootstrap is one of them, which combines HTML and CSS. What impressed me the most in the process of learning Bootstrap was its "grid system". It may be the most amazing CSS code I encountered when I was learning the front-end. I am deeply impressed by the author's ingenious application of CSS! The following is an introduction to the functions and main functions of HTML, CSS, JavaScript and Bootstrap.

        (1) HTML

        HTML stands for "Hypertext Markup Language" and is a markup language. It includes a series of tags. Through these tags, the document format on the network can be unified, and the scattered Internet resources can be connected into a logical whole. HTML text is a descriptive text composed of HTML commands, which can explain text, graphics, animations, sounds, tables, links, etc. Hypertext is a way of organizing information. It associates text, graphics and other information media in the text through hyperlinks. These interrelated information media may be in the same text, or may be other files, or files on a computer located at a geographically distant location. This way of organizing information connects information resources distributed in different locations in a random way, providing convenience for people to search and retrieve information.

        (2) CSS

        CSS, or Cascading Style Sheet, is a computer language used to represent file styles such as HTML (an application of Standard Generalized Markup Language) or XML (a subset of Standardized Generalized Markup Language). CSS can not only modify web pages statically, but also dynamically format elements of web pages with various scripting languages. CSS can precisely control the layout of element positions in web pages at the pixel level, supports almost all font sizes and styles, and has the ability to edit web page objects and model styles.

       (3) JavaScript

        JavaScript is a lightweight, interpreted or just-in-time compiled programming language with function first. Although it is famous as a scripting language for developing Web pages, it is also used in many non-browser environments. JavaScript is based on prototype programming, a multi-paradigm dynamic scripting language, and supports object-oriented, imperative, declarative, and functional programming paradigm. The characteristics of JavaScript are: it is an interpretive scripting language (the code is not precompiled); it is mainly used to add interactive behavior to HTML (an application under the standard general markup language) page; it can be directly embedded in HTML pages, but written as a separate js files are conducive to the separation of structure and behavior; cross-platform features, supported by most browsers, can run on multiple platforms (such as Windows, Linux, Mac, Android, iOS, etc.); JavaScript scripting language is the same as other Like the language, it has its own basic data types, expressions, arithmetic operators and the basic program framework of the program; JavaScript provides four basic data types and two special data types for processing data and text, and variables provide storage Where there is information, expressions can complete more complex information processing.

        (4) Bootstrap

        Bootstrap is a simple, intuitive, and powerful front-end development framework based on HTML, CSS, and JavaScript, making Web development faster. Bootstrap provides elegant HTML and CSS specifications, which are written in the dynamic CSS language Less.

2. Network foundation (XML, HTTP, Tomcat)

        XML, Http, and Tomcat are necessary basic knowledge before learning web application development. Among them, Tomcat is used to build and run the offspring server, Http is used to specify the communication rules between the client and the server, and XML is mostly used for data transmission and writing server configuration files . Their specific functions are as follows:

        (1) XML

        Extensible Markup Language, a subset of Standard Generalized Markup Language, or XML for short. Is a markup language used to mark up electronic documents to make them structured. In electronic computers, tags refer to information symbols that computers can understand. Through such tags, computers can process various information such as articles. It can be used to mark data, define data types, and is a source language that allows users to define their own markup language. It is well suited for World Wide Web transport, providing a unified method for describing and exchanging structured data independent of application or vendor. It is a cross-platform and content-dependent technology in the Internet environment, and it is also an effective tool for processing distributed structural information today.

        The main differences between XML and HTML are: ML is a software and hardware independent tool for transferring and storing data; it focuses on data. HTML is used to display data and focuses on the appearance of data; XML provides a framework for defining a markup language, HTML itself is a markup language; XML is case sensitive. HTML is case-insensitive; XML is neither a markup language nor a programming language. HTML is a hypertext markup language; we can define our own XML tags as needed. HTML has its own predefined tags, which cannot be defined by users; XML mandates the use of closing tags. In HTML, there is no need to use closing tags; XML is dynamic because it is used to transfer data. HTML is static because it is used to display data. XML preserves spaces. HTML does not preserve whitespace.

        (2) HTTP

        HTTP or "Hypertext Transfer Protocol" is a simple "request-response" protocol, which usually runs on top of TCP. It specifies what kind of messages the client may send to the server and what kind of responses it may get. The headers of request and response messages are given in ASCII; the message content has a MIME-like format. This simple model contributed to the success of the early Web because it made development and deployment very straightforward.

        (3) Tomcat

        Tomcat server is a free and open source web application server. It is a lightweight application server. It is widely used in small and medium-sized systems and occasions where there are not many concurrent access users. It is the first choice for developing and debugging JSP programs. For a beginner, it can be considered that when the Apache server is configured on a machine, it can be used to respond to the access request of the HTML (an application under the standard general markup language) page. Tomcat is actually an extension of the Apache server, but it runs independently at runtime, so when you run tomcat, it actually runs as a separate process from Apache.

3. The core technology of JavaWeb

        The core components of JavaWeb include: Servlet technology, session technology, JSP technology, EL expression, JSTL and JavaBean. Among them, Servlet technology is the most important thing. It is the core content and core of JavaWeb, and it is my key learning object this semester. Session technology, JSP technology, EL expressions, JSTL, and JavaBean all depend on Servlet, which is also the basis of other back-end frameworks (SSM, SpringBoot, etc.).

        (1) Servlet

        Servlet is the abbreviation of Java Servlet. It is called a small service program or a service connector. A server-side program written in Java has the characteristics of being independent of platforms and protocols. Its main function is to interactively browse and generate data and generate dynamic Web content. A Servlet in a narrow sense refers to an interface implemented by the Java language, and a Servlet in a broad sense refers to any class that implements the Servlet interface. Generally, people understand Servlet as the latter. Servlets run on application servers that support Java. In principle, Servlet can respond to any type of request, but in most cases Servlet is only used to extend the Web server based on HTTP protocol. JavaSoft's Java Web Server was the first to support the Servlet standard. After that, some other Java-based Web servers began to support standard Servlets.

        (2) Session technology (Session and Cookie)

        Servlet provides two objects for saving session data, namely Cookie and Session. Cookies can save the data generated during the session to the browser, so that the browser and server can interact better. In web applications, the function of a cookie is similar to a membership card. When a user accesses a web server through a browser, the server will send some information to the client, such as user information and product information, which are all stored in the cookie. In this way, when the browser accesses the server again, it will send the Cookie to the server in the request header, so that the server can make a correct response to the browser.

        Session can save session data to the server. When the browser accesses the Web server, the Servlet container will create a Session object and ID attribute. The Session object is equivalent to the medical record file, and the ID is equivalent to the medical card number. When the client subsequently accesses the server, as long as the ID is passed to the server, the server can determine which client sent the request, and thus select the corresponding Session object to serve it.

        (3) JSP

        JSP is a dynamic web technology standard. JSP is deployed on the web server, can respond to the request sent by the client, and dynamically generate a web page of HTML, XML or other format documents according to the content of the request, and then return it to the requester. JSP technology uses the Java language as a scripting language to provide services for users' HTTP requests, and can work with other Java programs on the server to handle complex business requirements.

        (4) EL expression

        EL (Expression Language) is to make writing JSP easier. The expression language is inspired by ECMAScript and XPath expression language, which provides a way to simplify expressions in JSP, making Jsp code more simplified. Accessing model objects in JSP is expressed through the syntax of EL expressions. The format of all EL expressions is represented by "${}". For example, ${userinfo} stands for getting the value of the variable userinfo. When the scope of the variable in the EL expression is not given, it will be searched in the scope of page by default, and then searched in the scope of request, session and application in turn. You can also use the scope as a prefix to indicate which scope the variable belongs to, for example: ${pageScope. userinfo} means to access the userinfo variable in the page scope.

        (5) JSTL

        JSTL, or JSP Standard Tag Library, is a standard specification formulated by JCP. It mainly provides a standard and common tag library for Java Web developers, and is maintained by Apache's Jakarta team. Developers can use these tags to replace the Java code on the JSP page, thereby improving the readability of the program and reducing the difficulty of program maintenance.

        (6) JavaBean

        JavaBean is a reusable component written in JAVA language. To be written as a JavaBean, the class must be concrete and public, and have a parameterless constructor. JavaBean exposes member properties of internal domains by providing public methods that conform to the consistent design pattern, and the set and get methods are obtained. As we all know, attribute names conform to this pattern, and other Java classes can discover and operate these JavaBean attributes through an introspection mechanism (reflection mechanism).

Fourth, the advanced features of Servlet

        The advanced features of Servlet mainly refer to Filter and Listener. Filter is used to modify request and response objects; Listener is used to monitor context, session and request events. The login verification function of a web page is a typical application of Filter and Listener.

        (1) Filter

        In the advanced features of Servlet, Filter is called a filter, which is located between the client and the handler, and can inspect and modify the request and response. Usually, the request is intercepted and some general operations are performed, such as filtering sensitive words, Unicode, enforce security controls, and more. Filter is like the sewage purification equipment in reality, which is specially used to filter sewage impurities.

        (2) Listener

        In web program development, it is often necessary to monitor certain events in order to process them in a timely manner, such as monitoring mouse click events, keyboard press events, and so on. To this end, Servlet provides a listener (Listener), which is specially used to monitor Servlet events. Listener involves several important components in the listening process: event, an operation of the user, such as clicking a button, calling a method, creating an object, etc.; event source, the object that generates the event; event listener: responsible for listening Events that occur on the event source; event handler: the member method of the listener, when the event occurs, the corresponding handler (member method) will be triggered.

Five, MVC design pattern

        In the classic MVC pattern, M refers to the business model, V refers to the user interface, and C refers to the controller. The purpose of using MVC is to separate the implementation codes of M and V, so that the same program can use different forms of expression. Among them, the definition of View is relatively clear, which is the user interface.

        M is the model model, which means that the model expresses business rules. Of the three components of MVC, the model has the most processing tasks. The data returned by the model is neutral, and the model has nothing to do with the data format. Such a model can provide data for multiple views. Since the code applied to the model can be reused by multiple views, it reduces code duplication. sex.

        V is the View view refers to the interface that the user sees and interacts with. For example, a web page interface composed of html elements, or a software client interface. One of the benefits of MVC is that it can handle many different views for an application. There's no real processing happening in the view, it's just a way of outputting data and allowing the user to manipulate it.

        C is the controller controller means that the controller accepts the user's input and calls the model and view to complete the user's needs. The controller itself does not output anything or do any processing. It just receives the request and decides which model component to call to process the request, and then decides which view to use to display the returned data.

6. The development trend of Web back-end technology

        It is not difficult to see through a semester of study that web technology is always developing in the direction of light weight, scalability, good maintainability and cost saving. The MVC design pattern is the most typical of the generation, and its ideas are still applicable today. The popular Spring framework is one of the mature open source frameworks. Its low cost, good scalability, and good maintainability are the fundamental reasons why it is favored by developers and enterprises.

おすすめ

転載: blog.csdn.net/m0_47015897/article/details/128386052