Ganesh
Ganesh

Reputation: 934

How to configure Struts Framework to Eclipse

I would like to add the struts framework to my eclipse helios j2ee version. Plese give me the guidance regarding this.

Thanks in advance.

Upvotes: 4

Views: 19926

Answers (1)

Alessandro Menti
Alessandro Menti

Reputation: 1320

  1. Create a new Java EE project in Eclipse.
  2. Download the Apache Struts framework from its website.
  3. If you use Maven as your build system, add the Structs artifact (see here). If you use another build system, unzip the downloaded framework and add these files to the WEB_INF/lib folder of your application:
    • commons-fileupload-X.X.X.jar
    • commons-io-X.X.X.jar
    • commons-logging-X.X.X.jar
    • commons-logging-api.X.X.jar
    • freemarker-X.X.X.jar
    • ognl-X.X.X.jar
    • struts2-core-X.X.X.X.jar
    • xwork-core-X.X.X.jar
    • javassist-3.7.ga.jar
  4. Configure the Web application so that the Struts framework will handle all page requests by adding these lines to the web.xml file:

    <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>
    
  5. Create the struts.xml configuration file.

  6. Create the JSPs you need.
  7. Build the application.

Source (and further information): http://struts.apache.org/2.2.3/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.html

One more jar you need to add that is commons-lang3-x.x.jar

Upvotes: 5

Related Questions