Build a struts2 development environment under eclipse

Source: Internet
Author: User
Build a struts2 development environment under eclipse

Transfer http://hi.baidu.com/xiang_song/item/9b90dab4dfdf729c1846975c

Build a struts2 development environment under eclipse Blog type:

    • Java

Eclipsetomcatjspstrutsjdk

Author: bukebushuo
Source: http://blog.csdn.net/bukebushuo/archive/2007/03/29/1545728.aspx

I recently downloaded the latest struts 2.06. Some problems were encountered in the configuration when using the examples included in it.

After many attempts, the configuration was successful. Write the configuration process for your reference!

Software 1: 1 eclipse + lomboz 3.2

: Http://forge.objectweb.org/project/showfiles.php? Group_id = 97 & amp; release_id = 1864 (webpage)

Http://forge.objectweb.org/project/download.php? Group_id = 97 & file_id = 7714 (file), not always valid.

2 Tomcat 5.5

: Http://tomcat.apache.org/download-55.cgi

Http://www.eng.lsu.edu/mirrors/apache/tomcat/tomcat-5/v5.5.23/bin/apache-tomcat-5.5.23.zip

3 JDK 6

: Http://java.sun.com/javase/downloads/index.jsp

4 struts2.06

: Http://struts.apache.org/download.cgi#struts201

Ii. installation:

1. Install JDK 6 as per your favorite installation. JDK must be installed before eclipse, because JDK is required for eclipse startup.

2. install Tomcat. The downloaded tomcat version is directly decompressed. After decompression, copy it to a place. After copying it, note that you need to copy the tools in the JDK 6 directory. jar is copied to Tomcat, specifically the tools under the JDK lib directory. copy jar to common \ Lib under tomcat.

3. Install eclipse. Extract the downloaded lomboz and obtain an eclipse directory. Copy the directory to a location that is easier to find.

To shorten the file name length. Decompress the package to the root directory of a hard disk, and copy the package to the desired directory.

4. Decompress struts2.06 and extract the downloaded struts2.06 package to a directory. There are several. War files in its apps directory.

You can use WinRAR to open, Here we only use WinRAR to extract the struts2-blank-2.0.6.war file to this directory can be.

Iii. Configuration

1: configure the working directory

The first time you open eclipse, you will be asked to specify your working directory. Please select your working directory. In the future, the configuration of your Eclipse project will be placed in this directory.

2: Configure jres

Open configuration dialog box

[Url = Response

Select jres Configuration

Select Browse. In the displayed dialog box, select your installed JDK 6 and click OK.

As shown in figure, if the project is large and requires a large amount of memory, you can add the memory setting parameters in the default VM arguments.

Click OK to repeat the above action and add jre6.

After the jdk1.6.0

3: Configure Tomcat

Select Server configuration page

In the dialog box that opens below, select Tomcat 5.5

Click Next, as shown in figure

Select the Tomcat directory you have installed in the Tomcat address bar, and select jdk1.6.0 In the JRE column. If you are prompted to start Tomcat later

The JRE configuration is incorrect. You can modify it again. Click Finish, as shown in.

4. Create a strust2 Project

Create a web project. As there is no suitable plug-in for directly generating struts2 projects, we should first create a common web project, and then use simple configuration to make it functional as struts2.

1. Create a project from the menu. Open the following screen and select create dynamic project.

Click Next, as shown in the following figure. Enter the new project name. If the previous settings are correct, Tomcat will automatically

You can also click the new dialog box to create a new server. The process is the same as that of the previous server creation process.

Click Finish to complete the project creation. The constructed project structure is as follows.

The project you created exists in the working directory you specified. You can also right-click your project name and select Properties.

In the displayed Properties dialog box, you can find the position of your project. For example.

5. Configure the struts2 Project

Add the struts2 function based on the previously created Project.

1. Add the struts2 development kit.

Copy all. Jar files in the lib directory under the decompressed struts2-blank-2.0.6.war directory to the lib directory of the new project.

The copy method can be: select all files under the lib directory, right-click and select copy.

In eclipse, right-click the lib directory and choose paste from the shortcut menu, as shown in figure

Right-click the project name and choose refresh from the shortcut menu, or press F5.

Then, the newly appended jar package will be found in the following directory.

2. Copy the Web. xml file

Select and copy the preceding web. xml file and paste it on Web. XML in eclipse.

3. Copy the Struts. xml file, related java files, and other xml configuration files.

Select the above files and folders and copy them to the following location. Note: This operation is pasted in package explorer.

.

How do I switch to package explorer? See the illustration below.

4. Copy JSP files

Select the index.htm file and copy the JSP directory to the following location.

 

The above file to the following location.

5. After the copy is completed, delete the build. BAT file. Shows the file structure of the final project. (No file changed)

Run the struts2 Project

1. compile the project

This step can be omitted if it has been marked as automatic compilation. Otherwise, compilation is required before the project runs. For example.

2. configure Server-Tomcat

In this case, you can export the project to the Tomcat directory and manually start Tomcat for testing. However, this is very troublesome,

You can directly start Tomcat in eclipse and test our project directly, which is much more convenient. For example.

Open the following window. If you have configured a window that may appear different from the window below, you can select tomcat5.5.

Select Tomcat and click Next. We can see that our project has been appended to config.

Click Finish

Running screen as shown in Figure

Response page (index.html)

Welcome Page (welcome. jsp)

Now that the configuration is complete, you are welcome to correct the omissions!

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: info-contact@alibabacloud.com 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.