Hi All, I'm trying to apply Tiles in my Struts application for the first time and I'm getting this error: "javax.servlet.ServletException: TilesContainer not initialized" when I execute test.jsp. I'm using Struts 1.3 and Tiles 2.1.3. Relevant code snippets of various files are shown below.
I was wondering if anyone could help me out here . . . Thanks, Rob ************** Web.xml ********************************* [code] <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="2.3" 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/j2eehttp://java.sun.com/ xml/ns/j2ee/web-app_2_3.xsd"> <display-name></display-name> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</ servlet- class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param- value> </init-param> <init-param> <param-name>debug</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>validate</param-name> <param-value>true</param-value> </init-param> <load-on-startup>2</load-on-startup> <servlet> <servlet-name>tiles</servlet-name> <servlet- class>org.apache.tiles.web.startup.TilesServlet</ servlet-class> <init-param> <param-name>chainConfig</param-name> <param-value>org/apache/struts/tiles/ chain-config.xml</param- value> </init-param> <init-param> <param-name> org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG </param-name> <param-value> /WEB-INF/tiles-defs.xml,/org/apache/tiles/ classpath- defs.xml </param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </web-app> [/code] ************** struts-config.xml ********************************* [code] <plug-in className="net.sf.navigator.menu.MenuPlugIn"> <set-property property="menuConfig" value="/WEB-INF/ menu- config.xml"/> </plug-in> <plug-in className="org.apache.struts.tiles.TilesPlugin" > <set-property property="definitionsconfig" value="/WEB- INF/tiles- defs.xml" /> <set-property property="moduleAware" value="true" /> </plug-in> [/code] ***************** test.jsp *************************** [code] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><%...@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %> <html> <head> <title>test</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> </head> <body> <tiles:insertDefinition name="homePage" /> </body> </html> [/code] ***************************** tiles-defs.xml ******************************* [code] <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.1// EN" "http://tiles.apache.org/dtds/tiles-config_2_1.dtd"> <tiles-definitions> <definition name="homePage" template="/layouts/template.jsp"> <put-attribute name="title" value="Tiles tutorial homepage" /> <put-attribute name="menu" value="/menu.jsp" /> <put-attribute name="leftnav" value="/leftnav.jsp" /> <put-attribute name="body" value="/body.jsp" /> <put-attribute name="footer" value="/footer.jsp" /> </definition> </tiles-definitions> [/code] ********************* template.jsp ********************** [code] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><%...@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %> <html> <head> <title>test</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title><tiles:getAsString name="title"/></title> </head> <body> <table> <tr> <td colspan="2"> <tiles:insertAttribute name="header" /> </td> </tr> <tr> <td> <tiles:insertAttribute name="menu" /> </td> <td> <tiles:insertAttribute name="body" /> </td> </tr> <tr> <td colspan="2"> <tiles:insertAttribute name="footer" /> </td> </tr> </table> </body> </html> [/code]
