The password behind a complete Java Web project

Preface

Recently I have done several Java Web projects myself, including a company business project and a personal fun project. Write a note summarizing the gains and listing the skills and knowledge needed to do the whole process of doing the project, bringing to you the skills and knowledge that have not really touched the full Java Web.Students of the project have a more complete perspective, providing a so-called “overall situation view”, so that students can learn more targeted. Of course, the example items used here are very elementary and simple, so the gods don’t have to look down.

 

First, let’s start with the architecture of the website. Generally speaking, we divide the website into front-end and back-end. The front end is mainly responsible for the display of the page, and the back end is the realization of the business logic. Because of the rise of HTML 5, the front-end field has become more and more popular, the front-end technology is developing very fast, we do not do too much today, becauseNow Internet Co, front-end engineers and Java engineers are totally different two kinds of technical posts. So we still look at a project from the perspective of Java. In the years before the front end didn’t get that hot, or in the classic Java Web development model, we used Jsp TechnologyThe realization of operation as the presentation layer is actually the so-called front end. Of course, only understanding Jsp is not enough, but also need to understand html, css, js, Ajax and other front-end basic technology, in which Jsp technology plays the role of outer packaging. What about the back end? The backend is due to some implementations.Business logic Java code and database. Speaking of this, you can introduce the classic MVC mode in Web development, Model-View-Controller. View, that is, the presentation layer, Model, is used to carry the abstract structure of the data, and ContrOller is a bridge between View and Model. View exists in front-end code, Controller, Model and back-end code. In back-end code, in order to keep the code clean and readable, a layered approach is generally used, top-down into conTroller layer, service layer, Dao layer, data layer or persistence layer (directly dealing with database). Sometimes, in order to achieve decoupling, a responsive interface layer is added between the above base level to separate the interface from the implementation. In larger websites, there will be moreComplex architectures, such as caching between Dao and data layers, or using advanced technologies such as clustering and load balancing when access pressure increases, are not discussed in depth here.

So as we’ve seen above, a Web project requires a presentation layer on the front end, and a controller layer, a service layer, a Dao layer, and a persistence layer on the back end. In the presentation layer, besides the basic knowledge of HTML, CSS, JS, AJAX, JSP just mentioned, it is actually open.We will also use many framework technologies, such as tiles, velocity, FreeMarker and so on, to simplify the development of the presentation layer. In the persistence layer, besides JDBC, there are Mybatis, Hibernate and other frameworks to improve development efficiency.. Spring, as a framework that runs through the entire project, 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 and so on, of course, better still need to master a non relational database, MongoDB, Redis.

Master the above knowledge, Congratulations, you can start writing the Java Web project. But it will be written and not deployed, and our project can not be used. So here, our project code has been written. What should we do next? Of course, I need to find a container to run me.Our code. The container here does not refer to the data type in Java, of course, but to the application server, where it is important to distinguish between the application server and the Web server, as to what the Web server is, I’ll talk about it later. If a student is not very clear about the concept of the server, we can look at the next paragraph first.Come back to see) currently, the most popular application servers in the market are Tomcat, Jetty, JBoss and so on. Many people will ask why we need an application server. As the name implies, the application server is used to run our application code. What I need to mention here is Java.The Web uses dynamic web technologies such as Jsp and servlet, whose code is in the application server that must be run. So when we write the application code, we need to deploy our application to the application server. After deployment, how can users access it?? Do you want to access the application server directly? At this point, web server is needed. In the Internet, the most powerful application layer protocol is the HTTP protocol, people visit the website is through the HTTP protocol to access, and the Web server is supporting the HTTP protocol server, theSo it’s called HTTP server. The Web server receives the HTTP request and then transfers the request to the application server. Some people will ask the user directly access to the application server is not good? Why do we need to give the web server and then to the application server? From the function realization, it is possible. Many applicationsServers, such as Tomcat, have the function of web server, so direct access can also be done. But in the actual production environment, due to load balancing, CDN acceleration and other reasons, we still need to add a web server in front of the application server to improve access efficiency, commonly usedThere are servers like Nginx and Apache.

I was always talking about this server, the server, I don’t know if any of my classmates were ignorant. In fact, the concept of server, we should have heard before really touching the field of computer science, such as before playing games feel that the card when everyone occasionally used the word server. But I am right.The solution and research server started after learning tomcat, jetty. So what is the server? The concept of a server is very simple. It’s just a computer. What’s the difference between a server and a computer we use everyday? First, it usually has no monitors. It has only hosts. Second,Its operating system is different from our commonly used windows, Mac OS. More isnixSystem. Third, it runs some server-side software. For example, Tomcat, Jetty, Nginx, Apache, which we mentioned above, are actually server software, but the host runs these software, so sometimes people get confused. thereforeAs we all know, the so-called database server is actually the host running the database. When it comes to servers, the key knowledge we need to master is the server operating system.nixSystems, such as CentOS, Ubuntu, etc.

Speaking of which, in fact, a simple and complete Java Web project is almost the same. Let’s review briefly. First, we need to use various frameworks and development techniques to write application code. Next, we need a host with *nix system installed and Web services installed on it.Server software, application server software, and then deploy our application code to the application server. Now we only need to get the IP address of the host, so that we can access the application remotely.

 

Read more

Share my three summary of learning Java backstage

Insisting: learning the first stage of Java backstage, I learned those knowledge.

List of knowledge points:

Development:

1、View layer technology — HTML, CSS, JS, AJAX, Tiles, Velocity, FreeMarker
2、Persistence layer technology — MyBatis, Hibernate
3、Spring , Spring MVC
4、Project building tool Maven
5、Log Log4j
6、Version control Git

Database technology:

1、SQLSentence
2、Parameter tuning

Operating system:

1、Mastering a Linux system, principle, Shell command

Server technology:
1、Skilled in using and understanding the principles of an application server technology (Tomcat)
2、Skilled in using and understanding the principles of a Web server technology (Nginx)

Additional:

Cache technology:

1、Skilled in using and understanding a Redis (Memcache, EhCache) technology.

Non relational database

Skilled use and understanding of a non relational database (MongoDB).

Middleware technology:

1、JMS:activeMQAnd kafka/
2、RPC: Dubbo

Design pattern:

1、Understand and be able to use several main design patterns.

Network:

1、Skilled in using and understanding a network development technology (Netty).
2、Familiar with HTTP, TCP protocol
JavaVirtual machine:

1、Familiar with JVM operation principle and memory distribution
2、jvmParameter tuning

>The original:
>blog.csdn.net/JasonLiuLJX/article/details/51494048

If you have any questions, please welcome me at any time!

 

Leave a Reply

Your email address will not be published. Required fields are marked *