You cannot use a definition in place of a URL. So your request to use /myapp/myapp.index does not work. If you want to use a definition as a URL, which is pretty handy since it eliminates extra pages and global definitions. You will need to create an action that takes a definition as a parameter or use the one supplied by the tiles implementation - DefinitionDispatcherAction - see the api. It lets you place a definition as a parameter and the action simply forwards to the definition. You then call the same action but with any tiles definition you want and it will render the definition.
Cal www.calandva.com -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Richard Hill Sent: Monday, December 08, 2003 7:59 PM To: '[EMAIL PROTECTED]' Subject: Tiles setup question I'm setting up tiles with an example application and I'm getting blocked when trying to use Tiles layout names instead of the JSP filenames in the struts-config.xml. I'm hoping that someone on this list can point out what I'm doing wrong. I can access the application by explicitly typing in "index.jsp" in the url, but when I try a page with a link defined in my struts-config.xml global-forwards name="index" I get an error message: The requested resource (/myapp/myapp.index) is not available. My tomcat localhost.log file show that the Tiles definition factory gets loaded...what am I missing? Thanks, Richard --------------------------- localhost.log --------------------------- 2003-12-08 16:05:59 action: Tiles definition factory loaded for processor ''. factory loaded : {myapp.default={name=myapp.default, path=/layouts/myappLayout.jsp, role=null, controller=null, controllerType=null, controllerInstance=null, attributes={header=/tiles/common/header.jsp, footer=/tiles/common/footer.jsp}} , myapp.index={name=myapp.index, path=/layouts/myappLayout.jsp, role=null, controller=null, controllerType=null, controllerInstance=null, attributes={body=/introduction.jsp, navbar=/tiles/tempNavBar.jsp, title=Myapp > Index, footer=/tiles/common/footer.jsp, header=/tiles/common/header.jsp}} } Factory initialized from file '/WEB-INF/tiles-defs.xml'. ---------------------------------- html source with link ---------------------------------- <font size="2"><a href="/myapp/myapp.index">[Return to Main Menu]</a></font> ---------------------------------- Error message when link is used ---------------------------------- type Status report message /myapp/myapp.index description The requested resource (/myapp/myapp.index) is not available. ---------------------------------- index.jsp ---------------------------------- <%@ page language="java" %> <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %> <tiles:insert definition="myapp.index" flush="true" /> ---------------------------------- tiles-defs.xml ---------------------------------- <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration//EN" "http://jakarta.apache.org/struts/dtds/tiles-config.dtd"> <tiles-definitions> <!-- ========== Master definition ============================== --> <definition name="myapp.default" path="/layouts/myappLayout.jsp"> <put name="header" value="/tiles/common/header.jsp" /> <put name="footer" value="/tiles/common/footer.jsp" /> </definition> <!-- ========== Index page definition ============================== --> <definition name="myapp.index" extends="myapp.default"> <put name="title" value="Myapp > Index" /> <put name="navbar" value="/tiles/tempNavBar.jsp" /> <put name="body" value="/introduction.jsp" /> </definition> </tiles-definitions> ---------------------------------- struts-config.xml ---------------------------------- <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> <struts-config> <!-- ======== Form Bean Definitions =================================== --> <form-beans> </form-beans> <!-- ========== Global Forward Definitions ============================== --> <global-forwards> <forward name="index" path="/myapp.index"/> </global-forwards> <!-- ========== Action Mapping Definitions ============================== --> <action-mappings> </action-mappings> <!-- ========== Message Resources Definitions =========================== --> <message-resources parameter="myapp.ApplicationResources"/> <!-- ========== Tiles Plug-in Configuration =========================== --> <plug-in className="org.apache.struts.tiles.TilesPlugin" > <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" /> <set-property property="definitions-debug" value="2" /> <set-property property="definitions-parser-details" value="2" /> <set-property property="definitions-parser-validate" value="true" /> </plug-in> </struts-config> ------------------------ web.xml ------------------------ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <!-- The Struts Action Servlet --> <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>definitions-config</param-name> <param-value>/WEB-INF/tiles-defs.xml</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>3</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>3</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <!-- Action Servlet Mapping --> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <!-- Struts Tag Library Descriptors --> <taglib> <taglib-uri>/WEB-INF/tlds/struts-tiles.tld</taglib-uri> <taglib-location>/WEB-INF/tlds/struts-tiles.tld</taglib-location> </taglib> <taglib> <taglib-uri>/struts</taglib-uri> <taglib-location>/WEB-INF/lib/struts.jar</taglib-location> </taglib> </web-app> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

