Java Reference
In-Depth Information
Just add TilesListener to web.xml as you would do to use Tiles with any
other Java web application:
Download email_17/web/WEB-INF/web.xml
<listener>
<listener-class>
org.apache.tiles.web.startup.TilesListener
</listener-class>
</listener>
Of course, you'll need to add the Tiles JARs and dependencies to /WEB-
INF/lib :
commons-beanutils-1.7.0.jar
commons-digester-1.8.jar
commons-logging-api-1.1.jar
tiles-api-2.0.5.jar
tiles-core-2.0.5.jar
tiles-jsp-2.0.5.jar
Optionally, you can add the TilesDispatch servlet:
Download email_17/web/WEB-INF/web.xml
<servlet>
<servlet-name> TilesDispatch </servlet-name>
<servlet-class>
org.apache.tiles.web.util.TilesDispatchServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name> TilesDispatch </servlet-name>
<url-pattern> * .tiles </url-pattern>
</servlet-mapping>
This allows you to use URLs that end in . tiles , and they will automat-
ically be resolved to the names of the definitions that you use in the
tiles.xml file. For example, in ContactListActionBean , you would return a
path such as "/contact_list.tiles" instead of "/WEB-INF/jsp/contact_list.jsp" :
Download email_17/src/stripesbook/action/ContactListActionBean.java
package stripesbook.action;
public class ContactListActionBean extends ContactBaseActionBean {
private static final String LIST="/contact_list.tiles";
private static final String VIEW="/contact_view.tiles";
@DefaultHandler
public Resolution list() {
return new ForwardResolution(LIST);
}
 
 
Search WWH ::




Custom Search