APPFUSE introduction (transferred from iron hand)

xiaoxiao2021-03-06  42

Open Source Frame Set APPFUSE

There are a lot about J2EE development initial tutorial. There are also many open source web application development tools. It is very difficult to decide which technology to use - and actually start using them more difficult. Once you decide to use Struts and Hibernate, how will you implement them? If you visit Hibernate and Struts website, maybe you can find some information about how to integrate them. But if you want to mix and use Spring? As a developer, the best way to learn is to open some examples and tutorials to explain how these things are extended to the actual application. To learn how to integrate various open source technologies, such as Hibernate, Spring, Struts, and ANT / XDoclet creation appfuse. The fascination of Appfuse is that you can start touching Hibernate, Spring, and Struts without having to know much more. Use test driver development, AppFUSE, and its tutorial call you how to quickly and effectively develop J2EE web applications.

The birth of Appfuse earlier 2002, I would like to get a contract, when I was still an independent developer. I have to do everything yourself, from the collection needs to create the DHTML page to the front-end. Although I have many years of front-end development experience, Struts, HTML, etc., but business logic is new to me. So I keep looking for J2EE mode to complete this new job of my new customer. Finally, I implemented business delegates, DAO, and service-oriented (ServiceLocator) - these are described in J2EE blueprints. When the contract is completed, I also get a new thing, write a book about JSP 2.0. The publisher is Wrox, and the title is Professional JSP 2.0. I wrote two chapters, one chapter is about struts, and the other is Web security.

When writing a technical book, you usually use an example program to help the instruction concept. But for those extensive examples, I have read enough. So I decided to write a beautiful, and I can use an example after writing is late. The initial idea is to have an application to help me explain how to start Struts and use xDoclets to complete a lot of heavy work. It must also have a lot of security features so that I can use it in another chapter I wrote, web security. So I started to develop Struts-xdoclets.

A few weeks later, I think "struts-xdoclet" is difficult to explain, so I name it AppUse. I developed an example program StrutsResume for the Struts section. After publishing Struts Resume, I need to extract some of the material to complete the generic starter appfuse I want. It spent almost 3 months, but I finally released the first official version of AppUse in April 2003.

From the initial release version, AppFuse has made a lot of changes and improvements. A large number of technical decisions are made according to experience. The most painful is to keep my value object (VO) and ActionForms synchronize, so ActionSform I use xDoclets. I found that writing JDBC is a very boring thing, and more boring is updating SQL statements and VO after adding new database columns. In order to solve this problem, I chose to use Hibernate as a persistence layer and use the ANT / XDoclet to dynamically create a database table. In order not to lose data in the table, I integrate DBUnit, and he can manually use it when each unit test is tested. I decided to use Tomcat / MySQL as the default server and database because I am most familiar with them. I integrate a large number of unit / inheritance tests, so I have to modify the modification of the test to verify all things to work correctly, including JSP, which is implemented by Ant Test-ALL. In March 2004, I transferd the AppFuse project from sf to java.net .. There are some reason that I do this. First, it is a subproject of sf and its user base grows very fast. It requires a special mailing list and forum. Second, java.net seems to be very characteristic in the promotion of the project, and I heard that their CVS system should be stable. My experience in Java.Net is better, it is a very stable system, and the administrator supports projects and helps promote it.

What is appfuse? So, introduce these history, what is appfuse? In its most core part, AppFuse is a web application, you can pack it into a .war and deploy it to a J2EE 1.3-compatible application server . Its designer helps you create a new project using new Target in its build.xml file. New target allows you to indicate a new project name, and database name. Once you have created a project, you can create a MySQL database using Ant Setup and deploy it into Tomcat.

In addition, you can use Ant Test-all to verify the basic features of your new application. In this way, you can be sneered, "What is much bigger? Everyone can create a .war file and deploy to Tomcat.". Oh, I agree. But do you have a setup-Tomcat target to configure Tomcat's JNDI connection pool resource and Most of the Mail Services? Appfuse is not a rocketic high-tech. In fact, it is not a directory creation, building a file, and a series of basic classes. But it has greatly accelerated the beginning of development of high quality and good testing.

AppFuse is trying to simplify the burden on Build, Test, and Deploy applications as much as possible. It basically eliminates the work of setting and configuration, which is usually more troublesome. And tools like Ant, Junit, XDoclet, Hibernate, and Spring are difficult to get started. In addition, like authentication, password prompt, "Remember Me," user registration, and user management, etc., is especially the features that are required to every web application. AppFuse also provides a tutorial involves developing DAOS, Business Delegate, Struts Actions (Spring Controllers), integrating Tiles, and Validation, and using Ant-based xDoclet tasks to generate master / detail JSP from the model object. It uses some flexible markers, such as Struts Menu and Display Tag.

In my opinion, its best part, he emphasized the concept and suggestion of the Java community. Directory Structure and Build files use Erik Hatcher and Steve Lowran ''s wonderful books Java Development with Ant this book. In this book, Erik builds an example application, which also motivates me using Ant and XDoclet - and is used in my Struts. When I started learning to use Hibernate, I made a lot of mistakes. First, I open and turn off their session objects in each DAO method. When Gavin tells me this is a bad idea, I modified it into the OpenSessionInView mode. I passed every session object to every method body, and this matter is repeatedly asked me to do this. I replied: "I want them to work more effective - do you have any good idea?" And a better way is to let session as the parameters of the construction period, so that he works very well.

Next, last year, I found Spring Framework and found that it was the most beautiful solution I saw. With its ORM support, you can eliminate some of the session processing in AppFuse; because Spring can handle them. AppFuse now uses spring ''s OpenSessionInviewInviewFilter. What I need to do is to configure it in web.xml, and it managed my session to open and close. When I integrate Spring to AppFuse, I deleted 2, 3 classes and reduced LOC to approximately 75%. All Hibernate issues that have been encountered have been solved. In addition, I can also add a DAO implementation using Ibatis quickly, and the implementation is still an object. In this project, I found that IBATI is very easy to use, and it works well under the complex database scheme.

AppFuse i is not only your web application, but also an example of displaying Hibernate, Spring, and Struts. How to inherit these different open source components in the tutorial. In a sense, AppFuse is a combination of various open source technologies. When I found Spring, it is very suitable because it is a bonded configuration assembly, and the delivery coupling between different layers. Erik ''s book has explained this advantage. Spring greatly simplifies my development of AppFuse, making me more focused on the best J2EE practices. In short, I used the best J2EE tool I used. I also know that Spring is not the terminator of J2EE app, because the previous AppFuse is also very good. However, it helps to answer all the previous "What should I ...", this is a wonderful medicine.

What is the future? AppFuse 1.5 is released in May. Its main feature is that Spring MVC can be used instead of struts. All tutorials have also been updated to educate users how to use Spring (or Struts). For AppFuse 1.6, I plan to add support for WebWork and SiteMesh, and make it easier to run unit testing in Eclipse and IDEA. At the end of the year, I hope to add support for TapeStry and JSF as a support feature of MVC. The intermediate layer and Hibernate will not change too much. I now he is very good. This is not said that I think AppFuse is perfect. I hope to continue to receive suggestions and feedback. This will drive me to continue to improve him.

When I find that there is an updated and easier way to develop web applications, they will be applied to the appfuse. Someone asked me why Appfuse does not support MiddleGen. The reason is very simple: I have never used it, or I need to use MiddleGen in the project. So I can't see why the reason is added to it. If I have a project used Middlegen, you can bet I will add support to it in Appfuse. Recently, I started using Spring's MVC framework instead of Struts. First, I found it difficult to understand, so I use Spring MVC to implement the web layer. Because the Web layer contains many other features in web applications, such as templates, checks, file upload, accidents, etc., I am learning Spring MVC's comic debos. Using and learning AppFuse is a good way to discuss the latest release of the tracker and relying on the project. And because of the APPFUSE unit test coverage, I can easily test the new version. This is also possible to find BUG in Tomcat and MySQL by testing AppFuse. With me, it is a test tool for testing the latest open source project.

AppFuse Lightequinox is a lightweight version of Appfuse. You can see it as a WebApp-Minimal application in Struts-Blank and Spring in Struts. This initiator version is for me, thinking that he is not strong enough. Just want to simplify it, there is no dependency when building.

Its design philosophy is to show the developer how the skeleton Struts / Spring / Hibernate app for QuickStart chapter in Spring Live. More features will be added in the future. But the main goal is to focus on the implementation of the skeleton.

How to use? The best way is Download it and read QuickStart Guide. AppFuse is a part of Java Enterprise Community. Its homepage is appfuse.dev.java.net.

转载请注明原文地址:https://www.9cbs.com/read-72798.html

New Post(0)