Eclipse WTP / Struts 2 / Tomcat 5.5 Setup

October 5, 2007

In this post, I will discuss setting up the environment and importing the struts-blank.war to get started with Struts 2 development in Eclipse WTP using Tomcat 5.5 for deployment.

1. Download EclipseWTP all-in-one zipped package from [http://www.eclipse.org]. Make sure Eclipse uses Java 5 or later. Otherwise the J2EE perspective is not enabled.

2. Download Tomcat plugin for Eclipse from [http://www.eclipsetotale.com/tomcatPlugin.html]. The plugin enables to control the Tomcat instance from within eclipse. It also redirects the tomcat debug information to eclipse console. It is very useful for debug purposes and the plugin works pretty well.

Copy/Paste the files into plugin directory of Eclipse installation.

3. Download struts-blank.war from [http://struts.apache.org/index.html]. This war will be imported into eclipse as a project and should be used as a starting point for other struts projects.

Configuring Tiles in Struts2

October 5, 2007

1. Add tiles listener to web.xml

<listener>
<listener-class>
org.apache.struts2.tiles.StrutsTilesListener
</listener-class>
</listener>

2. Add tiles.xml (empty shown below) file to WEB-INF

<?xml version=”1.0″ encoding=”ISO-8859-1″ ?>
<!DOCTYPE tiles-definitions PUBLIC
“-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN”
“http://struts.apache.org/dtds/tiles-config_2_0.dtd”>

<tiles-definitions/>

3. Add the following jars to your WEB-INF/lib folder

commons-beanutils, commons-collections, commons-digester, struts2-tiles-plugin, tiles-api, tiles-core, tiles-jsp

4. User tiles-default as the base package.

extends=”tiles-default”


Follow

Get every new post delivered to your Inbox.