Develop struts applications in eclipse

Source: Internet
Author: User
Tags tld

Develop struts applications in eclipseProgram

1. download and install the easy struts package
2. Configure and develop a struts application project
III. Summary
about the author

related content:
TCP/IP introduction


The Java area also contains:
Tools and products
Code and components
All articles
Practical Skills

Liu Dong,

Software Engineer of Zhuhai chuangi Technology Development Co., Ltd.

July 2003

1. download and install the easy struts package

1. Easy struts is openSource codeOrganize a project on The latest version is 0.64. You can download the compressed file on its website eclipse installation is not described here)

2. decompress the downloaded compressed package to the {eclipse} \ plugins directory, where {eclipse} is the directory of Eclipse. It should be noted that there should be one more subdirectory In the Plugins directory after decompression. The directory name is com. Cross. easystruts. Eclipse _ [VER], and [VER] is the corresponding version number.

3. Easy struts initialization settings: Start eclipse and open the setting window from windows to preferences. There is an option on the left of the window: Easy struts. As shown in:

Figure 1

Before setting easy struts, you must prepare the files required by struts (which can be downloaded from the Jakarta website), including struts. jar, and several description files used to define the tag Library include struts_html.tld, struts_bean.tld, and struts_logic.tld. Click "Easy struts" on the left of the settings window, and the initialization setting interface for "2: Easy struts" is displayed. Select struts 1.0 or Struts 1.1 based on the version of the downloaded struts. The latest version is Struts 1.1. Here we select Struts 1.1 and find and add the Struts. jar file in the library file required by Struts 1.1. In the Type Library description file required by Struts 1.1, we recommend that you add at least the three description files mentioned above: struts_html.tld, struts_bean.tld, struts_logic.tld, these three files are automatically copied to the project's WEB-INF directory when creating the struts application project. You can set other content on the interface according to the default value without any changes. OK. Click OK to close the Setting Dialog Box to make the setting take effect. Now we have completed the basic settings of easy struts to start struts development.

Figure 2

2. Configure and develop struts application projects

1. create a Java project and set it to support easy struts: Create a Java project, and name this project strutsdemo temporarily. After the project is created, besides the two files that eclipse uses to describe the Java project. project and. no other files except classpath. To integrate the project with easy struts, click the new icon on the toolbar, select Java> easy struts> Add easy struts support, and click the next button, as shown in Figure 3:

Figure 3

Click the next button to enter some basic information of the easy struts project, as shown in Figure 4:

Figure 4

On the page in figure 4, enter the Directory Name of the Web application, such as struts_demo. You only need to package the Directory into a war file when publishing it. Select the web application version based on the actual situation of the application server. We recommend that you use 2.3. Currently, most mainstream versions of the application server support 2.3 web applications. Select Struts 1.1. Modify the automatically generated package name of easy struts, such as test. struts. After you click "OK", easy struts automatically generates a file. easystrutsplugin and create a directory of the Web application server directory name just entered in the settings interface, which contains the WEB-INF subdirectory, easy struts will automatically copy several TLD files to the directory, we must also manually add struts. copy the JAR file to the WEB-INF \ lib directory.

A configuration file applicationresources. properties is generated at the same time, which can be used to store your own configuration information. This configuration file supports multiple languages. Struts will automatically obtain the corresponding configuration file based on the Environment configuration information. For example, corresponds to the configuration information in simplified Chinese. Web. XML is also generated at this time. This file has automatically defined the actionservlet entry and the parameters required by this servlet. You do not need to configure them any more, which greatly facilitates beginners to learn and use struts. To change the information you just entered, you only need to open the Properties dialog box of the project to modify these configurations.

2. develop a struts application: before developing a struts application, you must add struts to the project class path. jar and servlet. jar files or new struts program will have a lot of errors, and set the project's default Output Folder to \ struts_demo \ WEB-INF \ Classes. After decompression, the easy struts plug-in has added several wizards for creating Struts-related programs in the eclipse development environment. Click the new icon on the toolbar to open the dialog box shown in figure 3 and select Struts-related program development, for example, development of the most common action class and Development of Form class. The following describes the development of action classes.

In the create dialog box, select create easy action and click Next.

Figure 5

In the use case text box (Use Case), enter the name of the action class. Easy struts will automatically update the corresponding URL request path based on the value you entered) and action class name (type ). In this interface, the module name text box refers to selecting other files when multiple struts_config files exist. The struts_config.xml file is used by default. Form name is the choice made when the action class needs to be aligned with a form class. For other information, use the default value. Click Next to add error handling and redirect to the page. Click the "finish" button to complete the action Class Wizard. Easy struts automatically generates the class xxxxaction. Java and configures it in struts_config.xml. You can also double-click the struts_config.xml project file and operate the link on the struts_config.xml interface. This is a visual interface for editing the struts_config.xml content. As shown in:

Figure 6

Iii. Summary

Easy struts is still a development version, but its powerful functions and ease of use have been revealed. By combining with Eclipse, Struts development becomes a very simple task. This article briefly introduces how to use the easy struts plug-in to help us develop struts applications. There are already many Struts-related development projects.ArticleThis is not our intention, so there is no in-depth description here. All in all, there are many other functions of easy Struts that need to be explored.

Iv. References

Official website of eclipse;

Http:// easy struts Project Website

Http:// Apache struts website

About Author:

Liu Dong, software engineer of Zhuhai chuangyi Technology Development Co., Ltd., mainly engaged in J2EE development.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.