Let's talk about JavaWeb interviews

Welcome to click "The Beauty of Algorithms and Programming"↑Follow us!

This article was first published on the WeChat public account: "The Beauty of Algorithms and Programming", welcome to pay attention and learn more about this series of blogs in time. 

In two or three months' time, the 15th-level excellent students of our college will go out for internships. Recently, many students are asking how to prepare for JavaWeb interviews. The company conducts interviews with students, and it is more about the mastery of the students' basic knowledge.

So this article will tell you what are the foundations of JavaWeb? The foundation referred to in this article only involves knowledge in the field of JavaWeb, and does not involve other basic courses of computer science, such as computer network, data structure and other courses.

A very classic interview question was popular on the Internet before. When we entered a URL in the address bar of the browser and pressed the Enter key, we finally saw the webpage. What happened behind this?

This is a very open-ended question, and people with different backgrounds in different fields have very different perspectives on answering this question. In this article we will answer this question from the perspective of JavaWeb. After answering this question, you will know what the foundation of JavaWeb is and what angle should you prepare for the interview.

Since we are doing JavaWeb development, the most used WEB server is Tomcat, the most used database is Mysql, and the most used framework is the SSM framework.

First, a general flow chart based on the above technology:

 

The above picture shows very clearly what is the foundation of JavaWeb. The parts with ellipses are the parts you understand. When one day this picture no longer has ellipses, your JavaWeb foundation will be very solid.

1 From Socket to Servlet

Socket is where the development of network applications begins. When we first learned about Socket, we used Socket to write simple chat programs. Tomcat is also a Socket-based network application. It just opens the port and starts listening. If there is a client request, it starts to process the request.

But when we are doing JavaWeb development, we don't need to deal with any Socket, but start from Servlet, and the most exposed concept is Servlet, so we can't help but ask what happened from Socket to Servlet?

The same is for network application development. Why can I do network application development without knowing the knowledge of Socket?

The above picture just shows the starting point from Servlet to a thread, not to Socket, but it is very complicated from the picture, and then to Socket, you need to know more knowledge, when one day above When these concepts are no longer unfamiliar to you, then you can confidently say that you have no problem going from Socket to Servlet.

The doGet method of Tomcat source code analysis (1)

doGet method of Tomcat source code analysis (2)

doGet method of Tomcat source code analysis (3)

The doGet method of Tomcat source code analysis (4)

Chinese garbled code analysis of Tomcat source code (1)

2 From Servlet to JSP

When doing JavaWeb development, another concept we are most exposed to is JSP, so what is JSP? What is the relationship between JSP and Servlet? Why can JSP's built-in objects be used directly without definition? If you understand the picture below, you will understand why.

3 From Servlet to Controller

When doing JavaWeb development now, few people may write Servlet anymore, because it is really troublesome, and more use SpringMVC Controller for development. If you are in contact with the Controller at the beginning and do not understand the concept of Servlet, it is a pity that you need to supplement more knowledge.

After understanding the above picture, you will understand what is going on from Servlet to Controller.

4 From JDBC to Mapper

Now almost all application systems are inseparable from the database, and when Java is doing database development, the most primitive technology is JDBC. But we found that when we are doing database development, we basically no longer use the original technology above, and instead use more advanced framework technologies such as Mybatis and Hibernate. So we also have to ask what happened from JDBC to Mybatis? Mapper is just an interface, why didn't I instantiate it manually, but I could use its methods?

The BlogMapperProxy proxy object is generated by BlogMapper by using the dynamic proxy technology of JDK. When executing the specific method of the interface, it goes through the following process, and finally reaches the PreparedStatement of JDBC, then executes SQL, and finally completes the encapsulation of the result. Although a simple sentence can describe all the processes, but for you, you need to understand everything that happens behind it.

 

Summarize

This article summarizes the basics of JavaWeb interviews, and introduces you to the core basic knowledge of JavaWeb technology from a macro perspective. Excellent companies should pay more attention to your basic knowledge. I believe that if you understand the above basic knowledge, you will be exposed to any new The framework of a new technology, you can get started very quickly, and can essentially understand this new technology.

More great articles:

The append method of StringBuffer source code analysis

The add method of ArrayList source code analysis

Volley source code analysis (1)

Let's talk about JavaWeb interviews

In-depth understanding of ArrayList (1)

In-depth understanding of ArrayList (2)

In-depth understanding of ArrayList (3)

Java Interview Basics (1)

Java Interview Fundamentals (2)

Java Interview Fundamentals (3)

Let's talk about microcontrollers and servers

50 lines of code to implement a simple web server

50 lines of code to implement a website server 2

50 lines of code to implement a website server 3

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324394024&siteId=291194637