preface
Recently, I have learned JavaWeb after leByte education, and I have done several Java Web projects, including business projects of the company and small fun projects of my own. I will write an article to record and summarize the gains and list the skills and knowledge points needed in the whole process of the project. It gives students who have not really been exposed to the full Java Web project a more complete perspective, provides a so-called “big picture”, and makes it easier for students to learn more specifically. Of course, the example projects used here are very rudimentary, simple projects, so you don’t have to look down.
First of all,
Let’s start with the architecture of the site. In general, we divide websites into front-end and back-end. The front end is mainly responsible for the display of the page, and the back end is the implementation of business logic. Due to the rise of HTML5, the front-end field has become more and more hot, and the development of front-end technology is extremely fast. We will not introduce it too much today, because front-end engineer and Java engineer are two completely different technical positions in Internet companies now. So let’s look at a project from a Java perspective. In the early years when the front end was not so popular, or in the classic Java Web development model, we used Jsp technology as the implementation of the presentation layer, which is actually called the front end. Of course, only Jsp is not enough to understand HTML, CSS, JS, Ajax and other front-end basic technology, Jsp technology in which play the role of outer packaging. What about the back end? The back end is composed of Java code and a database with some implementation of the business logic. This brings us to the classic MVC pattern in Web development, model-View-Controller. View is the presentation layer, Model is the abstract structure used to hold data, and Controller is the bridge between View and Model. The View lives in front end code, the Controller, the Model lives in back end code. In order to keep the code clean and easy to read, the back-end code is generally divided into controller layer, Service layer, DAO layer, data layer or persistence layer (directly dealing with the database) from the top down. Sometimes, for decoupling purposes, a responsive interface layer is inserted in the middle of the above base layer to separate the interface from the implementation. In larger sites, there will be more complex architectures, such as a caching layer between the DAO layer and the data layer, or the use of clustering, load balancing and other advanced technologies when the access pressure increases, but we will not discuss complex architectures in depth here.
so
As we saw above, a Web project needs a presentation layer at the front end and a Controller, Service, DAO, and persistence layer at the back end. Just mentioned in the presentation layer, and in the HTML, CSS, javascript, ajax, JSP and other basic knowledge, in the actual development, we will also use many framework technology, such as tiles, velocity, freemarker template technology to simplify the development of the presentation layer. In the persistence layer, in addition to JDBC, there are frameworks such as Mybatis and Hibernate to improve development efficiency. One of the most prominent features of the Java Web is Spring, which as a project – wide framework brings dependency injection, aspect – oriented programming capabilities to project development. In addition to these, we also need to master the use of a relational database, such as MySQL,Oracle, etc., of course, better also need to master a non-relational database, MongoDB, Redis.
With that in mind, congratulations, you’re ready to start writing Java Web projects. But all writing but not deploying, our project was still not ready for use. So now that we’ve written our project code, what do we do next? Of course we need to find a container to run our code. By container, I mean not Java data types, but application servers, and I want to make a special distinction between application servers and Web servers, which I’ll talk about later. Currently, the main popular application servers in the market are Tomcat,Jetty, JBoss, etc. A lot of people ask why do we need an application server? As the name suggests, the application server is where our application code runs. In particular, Java Web uses dynamic Web technologies such as JSPS and servlets, whose code must be in the running application server. So when we write the application code, we need to deploy our application to the application server. Once the application is deployed, how do users access it? Direct access to the application server? This is where the Web server comes in. On the Internet, the most powerful application layer protocol should be HTTP protocol, people visit the website is through HTTP protocol to access, and the Web server is to support HTTP protocol server, so it is called HTTP server. The Web server receives the HTTP request and forwards it to the application server. Is it bad for users to access the application server directly? Why give it to the Web server and then to the application server? In terms of functional implementation, yes. Many application servers, such as Tomcat, function as Web servers, so direct access is also possible. However, in the actual production environment, due to load balancing, CDN acceleration and other reasons, we still need to add a Web server in the front end of the application server to improve access efficiency, commonly used Nginx,Apache and other servers.
Before always talking about this server, that server, DO not know whether the students listen to meng. In fact, the concept of server, we should really contact the computer professional field before heard, for example, before playing games feel card when we will use the word server from time to time. But I didn’t really understand and study servers until I learned Tomcat and Jetty. So what exactly is a server? The concept of server is actually very simple, is a computer, that it and our daily use of the computer what is the difference? First, it usually doesn’t have a monitor, it just has a mainframe. Second, its operating system is different from Windows and Mac OS. More * NIx systems. Third, it runs some server-side software. For example, Tomcat, Jetty, Nginx,Apache, these are all server software, but the host runs these software, so sometimes people get confused. So the so-called database server, as you know, is actually the host that runs the database. Speaking of server, we need to master the key knowledge is the server operating system, that is, * NIx system, such as CentOS, Ubuntu and so on.
At this point, a simple, complete Java Web project would do just fine. To recap, first, we need to write application code using various frameworks and development techniques. Next, we need a host with * NIx system installed, install Web server software, application server software on it, and deploy our application code to the application server. Now we just need to get the IP address of the host to access the application remotely.
List of knowledge points:
Development:
1, the view layer technology, HTML, CSS, javascript, AJAX, Tiles, Velocity, FreeMarker
2. Persistence layer technology — MyBatis,Hibernate
3. Spring MVC
4. Project construction tool Maven
5. Log Log4j
6. Version control Git
Database technology:
1. SQL statements
2. Parameter tuning
Operating system:
1. Proficient in a Linux system, principle and Shell command
Server technology:
1. Proficient in using and understanding the principles of application server technology (Tomcat)
2. Proficient in using and understanding the principles of a Web server technology (Nginx)
Additional:
Caching technology:
1. Familiar with and understanding of a cache technology (Redis,Memcache, EhCache)
Non-relational databases
1. Proficient in using and understanding a non-relational database (MongoDB)
Middleware technology:
1. JMS:activeMQ and Kafka
2, the RPC: Dubbo
Design pattern:
1. Understand and be able to use the most dominant design patterns
Network:
1. Familiar with and understanding of a network development technology (Netty)
2. Familiar with HTTP and TCP protocols
Java Virtual machine:
1. Familiar with the running principle of JVM and memory distribution
2. Tune JVM parameters
The article reprinted the joy byte
Finally, I would like to recommend some super detailed Java self-study courses of B station:
MySQL database: BV1tK4y197JC
SpringBoot+Vue front and rear end separation project actual combat