Its recently made several Java Web project, the company’s business projects, also have individual doing play small projects, written records article summarize the harvest, to list in the whole process of project to do, the necessary skills and knowledge required to has not really come into contact with a complete Java Web students a more complete view of the project, To provide a so-called “big picture view”, also so that students can more targeted learning. Of course, the example projects used here are very rudimentary, simple projects, so you don’t have to look down. Article reprinted: Le Byte

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 layer, service layer, DAO layer, 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, the key knowledge we need to master 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. Article reprinted: Le Byte

List of knowledge points:

Development:

View layer technology, HTML, CSS, javascript, AJAX, Tiles, Velocity, FreeMarker persistence layer technology, MyBatis, Hibernate, Spring, Spring MVC project build tool Maven log Log4j version control GitCopy the code

Database technology: 1. SQL statement 2. Parameter tuning

Operating system:

Proficient in a Linux system, principle and Shell commandCopy the code

Server technology:

Proficient in using and understanding the principles of an application server technology (Tomcat) and the principles of a Web server technology (Nginx)Copy the code

Additional:

Caching technology:

Proficient in using and understanding a cache technology (Redis,Memcache, EhCache)Copy the code

Non-relational databases

Proficiency in and understanding of a non-relational database (MongoDB)Copy the code

Middleware technology:

JMS:activeMQ and Kafka RPC: DubboCopy the code

Design pattern:

Understand and be able to use the most important design patternsCopy the code

Network:

Proficient in using and understanding a network development technology (Netty) familiar with HTTP, TCP protocolCopy the code

Java Virtual machine:

Familiar with JVM operation principle, memory distribution JVM parameter tuningCopy the code

Like you can pay attention to B station Xiao Wang learning Java