A lot of developers will complain that Struts is difficult, and the frame design is not good. It is affected by a wide range of frames. Of course, as a classic MVC framework, and there is a very much developer, Struts development has its own unique advantages. Let's take a look at how to develop a Struts application, here we develop a message version of the app, including some features: registered users, message, view, modification, etc.
1 Business prototype process: To understand business, simple is to model business processes. A lot of tools provide Struts-based business modeling. I recommend a tool Struts GUI here. It is a Visio plugin. I believe that in Visio is designed, it should be the best solution, at least the current Struts-based process modeling There is no more, direct and convenient than this software, and each element contains more information, and you can use Visio's powerful drawing function, you can experience it yourself. This design is also very easy to communicate with customers and related personnel, and the function reference encoded later.
2 Establish a web prototype: The business prototype process contains the organization, such as name and directory, while each element contains information about the information, believes that the page and page relationships such as the artistic framework will not be a problem. It is recommended to use Dreamweaver, which does not have to be said, and the Plugin, which can be graphically displayed by AnimalsGroup Struts Taglibs Translator (free), can graphically display the Taglib of Struts. 3 Select Tools: This should be an implementation of the project, you need to determine an IDE tool, which will be very effective for your development and management. Here, INTELLIJ IDEA is very simple. The IDEA's encoding is strong, and J2EE, especially JSP functions, adding a PE plugin, I believe that your development will be convenient, don't doubt, we will demonstrate how to use Idea features in this regard.
4 Modeling (optional): If you want to use a certain UML tool, you can choose the VP, a lightweight modeling tool bound to IDEA, where we may use Spring and Hiberante, which modeling Easy, mainly using DAO mode, the interface is also relatively simple, not so complicated. This can be generated by UML modeling. 5 Writing a file template and build.xml file: There are many common code in the project, such as Struts Action, Form, and JSP, here we intend to establish such templates, all Action creation is created from this template, and templates are also Integrate xDoclet tags, which we can use xDoclet to generate struts-config.xml files without being responsible for maintenance. At the same time, we have to write the build.xml file of the project, and some common operations are performed in an ANT method so that we can detach the relevant operations, such as directory structure generation, compiling, generate profiles, packaging deployments, and more. 6 Encoding: Coding under the IDEA is a very pleasant thing, where we are not in the narrative code of the IDEA. Through the schema of the Struts, we can group files, such as logging in to include the following four files: logon.jsp, logonaction.java, logonform.java, and index.jsp, so we can target these files as One group, using Worksapces to do this so that we can divide the system's files into multiple file function groups for our management. At the same time, we need a PE plug-in because Struts will involve the Properties file, using PE you can easily manage and use these Properties files. 7 Test: Idea is very good to integrate junit, if you are tested manually, remember CRTL Shift F10 is OK. In this project we mainly conduct two tests: normal Java class test and struts Action test. Spring1.1.1
Integrate the JUnit test class, test the DAO interface and implementation will be very simple. Struts's Action Test requires StrutstestCase, and after the IDEA is set, the test will be very simple and valid. Summary: Through the above steps, I believe that you have a certain understanding of Struts, in fact, there are still many things in the project implementation, such as the methodology (XP and RUP), SCM, etc., this is just a guide for Struts development. Framework, provide a reference implementation for your Struts development, may involve AOP in Struts applications, such as authority management, etc. You can refer to SAIF, very good.