Apache Struts 2 Documentation > Home > FAQs > Does MyEclipse 6 support Struts 2?
Added by Ted Husted, last edited by Ted Husted on Jan 25, 2008

MyEclipse 6 is a great platform. Everything you need to develop enterprise-grade applications is in a single download, including a web container, (Tomcat), DBMS (Derby), Data Access Library (Hibernate), Dependency Injection System (Spring), and your choice of web application frameworks, such as Struts 1 and Tapestry. Even the Java runtime is included in the same download. And, since it's Eclipse, we can run it all in place, without tweaking any system registries or such. In fact, a complete, runnable system with a working application can be squeezedonto a 1GB USB drive.

MyEclipse may be an all-one-download, but we can still install any other Eclipse plugins that we might want to use. And, we can also install other frameworks, like Struts 2.

The simplest approach is to create a web application project in the usual way. Then, drag and drop the necessary Struts 2 dependencies into the WEB-INF folder that MyEclipse will create. The needed JARs are:

  • struts2-core
  • xwork2
  • freemarker
  • ognl
  • commons-logging

The commons-logging JAR is optional, but it helps. The versions will vary depending on which release of Struts 2 is being used. Just use whatever is provided in the Struts 2 lib distribution. (But not everything that is in the distribution!)

The one other step is to configure the web.xml to load the Struts filter. MyEclipse will create a starter web.xml. Just change it to look like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
       xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
       http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

       <filter>
       <filter-name>
               struts2
       </filter-name>
       <filter-class>
               org.apache.struts2.dispatcher.FilterDispatcher
       </filter-class>
       </filter>
   <filter-mapping>
       <filter-name>
               struts2
       </filter-name>
       <url-pattern>
               /*
       </url-pattern>
   </filter-mapping>
   <welcome-file-list>
       <welcome-file>index.html</welcome-file>
   </welcome-file-list>
</web-app>

And that's it! Welcome to Struts 2 and MyEclipse 6!