One. Download and install Easy Struts Package 1. Easy Struts is an item on SourceForge.NET on the Open Source Organization. The latest version is 0.64, which can be downloaded on its website http://sourceforge.net/projects/easystruts on load compressed file org.easystruts.eclipse_0.6.4. ZIP (Eclipse installation is not described herein) 2. Unfold the downloaded compression package to the {Eclipse} / plugins directory, where {Eclipse} is the directory where eclipse is located. It should be noted that there should be more subdirectory in the Plugins directory after decompression, and the directory name is: com.cross.easystruts.eclipse_ [ver], [VER] is the corresponding version number. 3. Easy Struts Initialization Setting: Start Eclipse, open the settings window through the menu Windows-> Preferences. There will be an option on the left side of the window: Easy Struts. As shown below:
figure 1
You must prepare the files required for Struts before setting Easy Struts (download on the Jakarta website), including struts.jar, then a few description files for defining tag libraries include: struts_html.tld, struts_bean.tld, Struts_logic.tld. Click the Easy Struts on the left side of the setting window to the initialization setting interface of the Easy Struts. Select Struts 1.0 or Struts 1.1 based on the version of the Struts, the latest version is Struts 1.1. Here we choose Struts 1.1 and find and add the struts.jar file in the library file required for Struts 1.1. In the type library description file required for Struts 1.1, it is recommended to join the three descriptions files mentioned earlier: struts_html.tld, struts_bean.tld, struts_logic.tld, these three files are automatically copied when creating a struts application project Under the web-infers of the project. The other content on the setting interface is basically in accordance with the default value, no need to change. Ok, click the OK button to close the settings dialog to make the settings take effect. To this end, we have completed the basic settings of Easy Struts to start Struts development.
figure 2
two. Configure and develop struts application items 1. New Java project is set to support Easy Struts: New Java project, which is named: strutsdemo, after the new project is newly created, except for the two files used by Eclipse itself. Project and .classpath do not have any other file. In order to integrate Easy Struts, simply click on the new icon on the toolbar, select Java-> Easy Struts-> Add Easy Struts Support and click the next button, as shown in Figure 3 below:
image 3
Click the next button to the input interface of some basic information of the Easy Struts item, as shown in Figure 4 below:
Figure 4
Enter a directory name of the web application in the interface of Figure 4, such as Struts_Demo, just package the directory into a WAR file when publishing. Depending on the actual situation of the application server, the version of the web application is selected. It is recommended to use 2.3. The mainstream version of most application servers supports version 2.3 web applications. Select Struts 1.1. Modify the package name of the EASY STRUTS automatically generated, such as Test.Struts. After clicking the finished button, the EASY STRUTS will automatically generate files .EasystrutSplugin, and create a directory for the web application server directory named in the settings interface, which contains a web-infrium directory, and Easy Struts will automatically copy several TLD files to this directory. Next, we must also hand in copying the struts.jar file to the web-inf / lib directory. At the same time, a profile is generated: ApplicationResources.properties, this file can be used to store user her own configuration information. This profile supports multi-language, Struts automatically obtains the corresponding profile according to environment configuration information, such as ApplicationResources_ZH_CN.Properties, corresponding to Chinese Simplified configuration information. Web.xml is also generated at this time, which automatically defines the ActionServlet entry, and the parameters required for this servlet, users do not need to configure, and greatly facilitate beginners to learn and use struts. To change the information you just entered, you only need to open the property dialog box to modify these configurations. 2. Developing a struts application: There is also a preparation work before developing a Struts application, you need to add struts.jar in the class path of the project and servlet.jar, which will have a lot of error messages when new Struts programs will be created. And set the default output folder of the project to / struts_demo / web-inf / class. After the decompression is completed, the Easy Struts plugin has added several wizards for creating a struts related program in the Eclipse development environment. Click New Icon on the Toolbar to open the dialog shown in Figure 3 to select the development of the Struts-related program, such as the most commonly used Action class development, the development of the FORM class, etc. Below we focus on the development of the Action class. Select New Easy Action in the New Dialog box and click Next button Figure 5
Enter the name of the Action class in the use case text box (Use case), Easy Struts automatically updates the path (PATH) of the corresponding URL request based on the value you entered. In this interface, the module name text box refers to the other file when there are multiple Struts_Config files, the default is to use struts_config.xml. The form name is a choice when the Action class needs to be done when the FORM class corresponds. Other information use the default value, click Next to add an error handling, and the jump process of the page. Click the completion button that has completed the Action class's wizard, Easy Struts automatically generates class xxxxaction.java, and makes corresponding configuration information in Struts_Config.xml. All of these wizards can also be done by double-clicking on the project file struts_config.xml, and perform links in the struts_config.xml interface, this is a visual interface to edit struts_config.xml content. As shown below:
Figure 6