Eclipse Builds STRUTS2 Environment

Source: Internet
Author: User

Build STRUTS2 Environment

The big aspect is divided into three steps:

1. Add a jar Package

2. Configuring Struts2 in Web. xml

3. Add the struts2 configuration file Struts.xml

Here are the detailed steps:

1. Create a new dynamic Web Project

2. Download struts on the Struts official website. The struts 2.3.30 are used here. http://struts.apache.org/

Open the downloaded package, go to apps, unzip the Struts2-blank package. Blank refers to an empty package, which is the most classic (most commonly used) package used in the development of STRUTS2.

Copy the Lib package inside the Struts2-blank\web-inf into the Lib package in the new project's webcontent (some habits are called webroot).

3. Copy the Web. XML under Struts-2.3.30\apps\struts2-blank\web-inf to the Web-inf directory of your project. Configure the filter filters for STRUTS2 in Web. Xml.

<?XML version= "1.0" encoding= "UTF-8"?><Web-appID= "Webapp_9"version= "2.4"xmlns= "HTTP://JAVA.SUN.COM/XML/NS/J2EE"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "Http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">    <Filter>        <Filter-name>Struts2</Filter-name>        <Filter-class>Org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</Filter-class>    </Filter>    <filter-mapping>        <Filter-name>Struts2</Filter-name>        <Url-pattern>/*</Url-pattern>    </filter-mapping>    </Web-app>

3. Copy the Struts.xml file to the SRC directory of your project in the Struts-2.3.30\apps\struts2-blank\web-inf\src\java or web-inf\classes directory.

If there is a warning, copy the address of line 4th. In Eclipse Windows-->preferences-->xml Select: XML Catalog, then add ...

When you turn it off and on, you'll be prompted to write something.

Eclipse Builds STRUTS2 Environment

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: 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.