What is Shale? Shale is not a packaged product with well-prepared documentation and rigorous tests, nor is it equipped with an automatic installation program and an elegant management interface. So what is Shale? Brett McLaughlin will unveil this Struts descendant in this article. This is the first article in a five-part series. In this article, Brett explains what Shale is and what is the difference between Shale and Struts frameworks, and how to install and set it in the development environment.
Among all the Web frameworks that have emerged in the past five years, Jakarta Struts is a Java & #8482; Framework most used by developers, therefore, the advent of future generations is worth noting. Although Shale is not the most popular framework, it is not the most familiar one, but it is still impressive. What's even more exciting is that Shale is not just a major upgrade of Struts and a new release version: it completely updates many core principles in Struts and adds the latest ideas in Web development.
In this five-part series, you will understand that the deviation between Shale and Struts is a double-edged sword. On the one hand, Shale is the descendant of the well-designed Struts. Shale's creators considered the advantages and disadvantages of Struts and proposed a next-generation framework comparable to their predecessors. On the other hand, as you will soon see in this series, Shale is a framework completely different from Struts, which implies a lot of new development work!
Shale is not just another revision of Struts, but has been extended to a height that can be reached by Struts. It contains some of the most important and recent development achievements in Java Web programming, including JSP Standard Tag Library (JSTL) and JavaServer Faces (JSF), and is built on these development achievements. Shale should be regarded as a different framework from Struts. In this series, I will return the Shale framework as it is. In this month's article, we will first give an overview of the differences between Shale and Struts, and then take you through the steps to install Shale and test the installation. Finally, I will give you some ideas, so that you can further participate in the Shale project (which is open source) and provide some relevant information. The purpose of the entire series is to show you how to install Shale and how to use Shale to build and develop projects. It rarely involves Shale's predecessors, namely the Struts framework.
Comment on Shale
If any new Web development framework wants to gain a place in this highly competitive field, it is best to withstand the evaluation under great pressure. The good news is that Shale alone has withstood a detailed investigation. However, the bad news is that because Shale is completely a product of rebuilding Struts, you must rewrite and retest all your Struts-based code to implement it. You will spend the same amount of effort writing a new Shale application, or converting a Struts application into a Shale application, just as Shale has nothing to do with Struts.
So next we can't help but ask, why should we adopt Shale? To get the answer, let me first explain the greatness of Shale, which is largely due to its Struts lineage, but this is not the only reason-and then discuss two major reasons why Shale was not released as an important revision of the Struts framework. In this way, you will have a better understanding of what you can get from the Shale, which will help evaluate whether it is worthwhile to use this next-generation framework.
Struts lineage
Shale reused a lot of Struts Code bases and claimed that Struts is its "parent" framework. Therefore, if you want to trust the value of Shale, you have to trust the value of Struts. First, Struts, as the first truly Web development framework, has great value. According to the Shale and Struts websites, the first batch of Code was submitted to the Struts CVS repository in June 2000, and Struts 1.0 was released at the end of 2001. When many developers are struggling to use JavaServer Pages (JSP) and ever-changing servlet specifications, struts provides an easy-to-use Model 2 method to build servlet and JSP-based Web applications. In other words, Struts enables Web developers to develop robust Web applications, instead of logging, distributed computing, JDBC, Servlet, JSP, JNDI, RMI, and a large number of other APIs and technologies.
The next thing Struts has to do is to maintain its strength: Starting from writing the first batch of code, Struts has been one of the most popular Web development frameworks for six consecutive years. So far, it is still a conversation among people. The materials in the pen are used less than any competitors. Because Struts is so popular and has a long life, it now has rich functions, good documentation, and is widely supported and easy to use, it is also easy to develop and manage it. Thousands of developers responded to questions on the Struts email list. Tens of thousands of developers tried Struts and reported problems, which made them easy to fix.
Finally, Struts is evolving. Many frameworks are relatively powerful at the beginning, and then stagnate (both commercial products and open source projects have such a phenomenon), while Struts always provides new features. When you download Struts, the Core Release also contains a robust validation engine, and Struts has been integrated with JavaServer Faces, it has a wide range of tag libraries and a Evolving Model 2 architecture, which introduces the latest ideas in the distributed n-layer application field. It also tells you that Struts also follows the new pattern that appears in the program design, such as IoC (Inversion of Control ). Struts is naturally integrated with the WebWork and Spring frameworks, both of which are of the best lineage and provide an entrance framework for using new methods in Web development.
In short, it is hard to find that there is something that cannot be done or is not supported in Struts. Obviously, we have to ask why should Shale have another chance? Why didn't Shale become the next version of Struts? There are two main reasons: one is related to the less-known new software release practices, and the other is related to the vulnerabilities in the well-known Struts Foundation. Let's consider these two reasons separately.
Analysis of releases
To understand why Shale is not a new release of Struts, you must first understand one or two things about the new software release. For a new software release, most users first look at a set of new features. The larger the version upgrade, the larger the user's expectation for new features. Therefore, if the software version is upgraded from 2.1 to 2.2, there should be some new features, but if the software version is upgraded from 2.2 to 3.0, there should be many new features. This is why users are always picky when new versions of large products (such as Microsoft Word) or operating systems (such as Windows and Mac OS X) Come out. For each new release, users always expect more new features.
Since most users focus on features, they do not realize that backward compatibility is the most valuable thing. Although everyone wants to add new and good options to Excel, they want better integration of Panther and iTunes, and better support for XUL in Gnome, but if the user's existing programs and files suddenly fail to run in the new version, I believe they will scream, "This is a bloody murder ". In this case, new features have no value.
The same applies to Struts. In general, each new version of Struts adds new features and maintains backward compatibility with previous versions. In addition, the new version of Struts also needs to support the old version of Java platform and Servlet specifications, because the installed old Struts must run on these platforms. These two requirements-backward compatibility and support for older Java APIs-are already a serious constraint for Shale. In particular, at least for the Java platform, the jsf api has become the central component of the Web. Although Struts also supports JSF, Shale relies entirely on JSF-this is simply impossible for Struts that requires backward compatibility.
Finally, a new project such as Shale is derived, and development activities are continued on existing projects such as Struts, which has unparalleled advantages. If Struts simply upgrades to 2.0 (or 3.0 or 4.0) and implements Shale without considering backward compatibility, for many people, the resulting porting will be painful, and some people may simply stop using Struts. Even if the old code base is still maintained, it is difficult for developers to take time to fix bugs, and they do not want to add features to an obsolete or old version of software.
For these reasons, it makes sense to make Shale a brand new project and build it on a new code base.
Shale's Service-Oriented Architecture
The last reason why Shale didn't become a new release of Struts is that it has nothing to do with the logic: instead, it is related to the Framework's ability to accept new methods into Web development. Shale is different from Struts in many aspects. Two of them are the most prominent:
Struts is integrated with JSF, while Shale is built on JSF.
Struts is essentially a huge and complex request processor, while Shale is a group of services that can be combined in any way.
Shale's dependence on JSF is far-reaching, surprising, and mostly positive. With the development of this series, I will study these meanings in depth. Before discussing other aspects, it is necessary to discuss in detail the second aspect that causes the difference between the Shale and Struts.
If you have used Struts for many times, you will realize that it can be considered as a request processor, through which you can accept the request and instruct the framework to process the request. You can specify the action to be taken, the model to be used, the view to be displayed to the user, the verification rules to be used, and the form to be displayed... Struts to be fully configurable. However, the core of all these is a request processor that provides services for each request. Such a processor is the most important and complex part of Struts, because it must be processed or managed for all the work involved in processing a request, almost no part of the Struts code base has nothing to do with the request processor or is not affected by it.
Therefore, Struts is basically difficult to make changes. If you want to modify the request processing method or change the order of each part in the request processing process, you will face huge difficulties. In fact, you have to rewrite the Struts code base. Modifying the request processor behavior is slightly feasible, but most of them cannot be changed. This is one of the key issues Shale is trying to solve (if you need the flexibility of the Web Framework ).
Shale does not have a central component like the Struts request processor. It is just a group of services with a large number. These services can be freely combined, and each service is loosely coupled with other services. Connect