Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the development process of Java Web framework technology?

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what is the development process of Java Web framework technology". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Java Web framework technology development process is how" it!

I. the concept of Java Web framework technology

The so-called Java framework, simply understood as a reusable design component, defines the architecture of the application, clarifies the dependency relationship, responsibility distribution and control flow among the whole design and collaborative components, and represents a set of abstract classes and the methods of cooperation between their instances. It provides a Context relationship for component reuse. Struts, Hibernate and Spring are commonly used frameworks in Java development, and they provide the most appropriate solutions for different application scenarios.

II. The development process of Java Web framework technology

Traditional Java Web applications are implemented by JSP+Servlet+Javabean, which realizes the most basic MVC layering and divides the program structure into several layers, including JSP responsible for foreground presentation, Servlet responsible for process logic control and Javabean responsible for data encapsulation. However, there are still some problems with this structure: for example, JSP pages need to use symbols to embed a lot of Java code, resulting in page structure confusion, Servlet and Javabean responsible for a lot of jump and computing work, tight coupling, low program reuse and so on.

In order to solve these problems, there is a Struts framework, which is a perfect MVC implementation, it has a central control class (a Servlet), for different businesses, an Action class is responsible for page jump and background logic operation, one or more JSP pages are responsible for data input and output display, and a Form class is responsible for transferring data between Action and JSP. A set of tags provided by the Struts framework can be used in JSP as simple as using HTML tags, but very complex logic can be accomplished. There is no need for a single line of enclosed Java code to appear in the JSP page from now on.

However, putting all the operation logic in the Action of Struts will make the Action class low reuse and logic confusion, so people usually divide the whole Web application into three layers. Struts is responsible for the display layer, which calls the business layer to complete the operation logic, and the business layer calls the persistence layer to read and write the database.

Using JDBC connection to read and write database, we most often open the database connection, use complex SQL statements to read and write, close the connection, and the obtained data needs to be converted or encapsulated and transmitted to the outside, which is a very tedious process.

Then came the Hibernate framework, which requires you to create a series of persistence classes, the properties of each class can be simply seen as one-to-one correspondence with the properties of a database table, of course, you can also achieve the correspondence of various table associations in the relational database. When we need to do something, we don't have to pay attention to the database tables. We no longer need to query the database line by line, only need to persist the class to complete the function of adding, deleting, changing and querying. Make our software development truly object-oriented, not messy code. My feeling is that using Hibernate reduces the amount of programming by 80% compared with the JDBC approach.

Now we have three layers, but what about the calls between each layer? For example, if the Struts of the display layer needs to call a business class, it needs to new a business class and then use it; the business layer needs to call the persistence layer class and new a persistence layer class to use it. Calling each other through this new approach is the embodiment of the worst design in software development. To put it simply, the caller depends on the callee, and there is a strong coupling between them, and if I want to reuse a class elsewhere, other classes that this class depends on also need to be included. The program becomes very messy, each class depends on each other and calls each other, and the degree of reuse is very low. If a class is modified, many of the classes that depend on it will be affected. For this reason, the Spring framework appears. The role of Spring is to completely decouple the dependencies between classes. If a class depends on something, it is an interface. As for how to implement this interface, it doesn't matter. As long as you get a class that implements this interface, you can easily inject the implementation class into the class that calls the interface through the xml configuration file. This dependency between all classes is completely replaced by configuration files. So the core of the Spring framework is the so-called dependency injection and control inversion.

The current structure is that Struts is responsible for the display layer, Hibernate is responsible for the persistence layer, and Spring is responsible for the middle business layer. This structure is currently the most popular Java Web application architecture in China. In addition, because Spring uses dependency injection and AOP (aspect-oriented programming), its internal model is so excellent that Spring itself has implemented a MVC framework that uses dependency injection, called Spring MVC. At the same time, in order to deal with things well, Spring integrates Hibernate, which promotes the management of things from the persistence layer of Hibernate to the business layer, making it more convenient and powerful to use.

III. Current popular framework technology and its development trend

In addition to the Struts, Hibernate, and Spring mentioned above, the more popular is the Spring MVC framework. Spring MVC is a follow-up product of SpringFrameWork and has been integrated into Spring Web Flow. The Spring framework provides a full-featured MVC module for building Web applications. Use Spring pluggable MVC architecture, so that when using Spring for WEB development, you can choose to use Spring's SpringMVC framework or integrate other MVC development frameworks, such as Struts1,Struts2, and so on. It is a typical textbook mvc framework, unlike struts and other frameworks that are variants or not entirely based on the mvc system, spring is the best for beginners or people who want to understand mvc, its implementation is textbook-like, it is a pure servlet system like tapestry, which is also its advantage over tapestry over struts. And the framework itself has code that looks easy to understand.

The emerging frameworks are Jersey, springboot, play, Vue.js, jfinal and so on. The Jersey RESTful framework is an open source RESTful framework that implements the JAX-RS (JSR 311 & JSR 339) specification. It extends the JAX-RS reference implementation and provides more features and tools to further simplify RESTful service and client development. Although relatively young, it is already a production-level RESTful service and client framework. Like Struts, it can also be integrated with the hibernate,spring framework. Because the market share of Struts2+hibernate+spring integration is too high, few people pay attention to Jersey. So there are few introductions about Jersey on the Internet. But it's a really good framework. For requesting services, for GET,DELETE requests, you even need to give only a URI to complete the operation.

The springboot framework is called an one-stack solution. Relatively lightweight, is also the current trend of micro-services; springboot itself is built on top of spring, a variety of ideas and features needless to say, remove the tedious configuration of spring, simplify the original spring development process, provide a variety of practical features such as metric,actuctor, etc.; the most important thing is that springboot comes with the entire springcloud ecology. The two frameworks have no problem for you to solve large, medium and small projects.

Play is more inclined to scala, with its own lightweight performance, with the gradual optimization of ease of use and scalability are getting better and better.

JFinal is an extremely fast web development framework based on Java language. Its core design goal is rapid development, less code, simple learning, powerful function, lightweight, easy to expand and Restful. It not only has all the advantages of Java language, but also has the development efficiency of dynamic languages such as ruby and python.

At this point, I believe you have a deeper understanding of "Java Web framework technology development process". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report