struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cedric Dumoulin <ced...@apache.org>
Subject Re: App Modules and multiple tiles configuration files...
Date Wed, 15 Jan 2003 16:47:35 GMT

  Hi,

  How do you call the page or action doing the forward to the tile ?
  Each module declaring a TilesPlugin have its own tiles definition 
factory and TilesRequestProcessor. They are access through the current 
module context (in fact the request). But, the module context is set 
only if you access the server through an struts action. If you access 
the server through something else, nothing is done. You need to switch 
the module context yourself (RequestUtils.selectModule(...)).
  However, if you try to get the tiles factory with the help of 
TilesUtil.getDefinitionsFactory(...), the appropriate context should be 
compute, even if you not access it through a struts action.

   Cedric

ajTreece wrote:

> Afternoon folks...
>
> I'm trying to not be a pain, but I can't quite get this to work and 
> could use some guidance... First off I'm using v1.1b3 (milestone 
> build) with a tomcat v4.1.18 server. I've divided my app into two 
> modules each having it's own struts config files. I've setup tiles so 
> that I have tiles-def.xml that will contain definitions common to both 
> modules (definition site.mainLayout) and a tiles-*-defs.xml file for 
> each module.
>
> My apologies for the numerous attachments. I've removed most of the 
> xml code in the attachments, but left enough valid code to convey the 
> problem. To break it down all I'm doing is displaying a home page for 
> each module. Each module has an action servlet that returns a success 
> forward and here is where the problem happens.
>
> The homepage servlet forwards to "home.page" which extends 
> "site.mainLayout" and also uses "home.page.layout" as the put value 
> for the "mainbody". This works as expected.
>
> The knowledge servlet forwards to "knowledge.home.page" which also 
> extends "site.mainLayout" but uses "knowledge.home.page.layout" as the 
> put value for the "mainbody". Here is the problem... 
> "knowledge.home.page.layout" is not found -or- executed. It just 
> leaves a blank area on the screen.
>
> A couple of permeation's I have tried with success.... IF I change 
> tiles-knowledge-defs.xml to use "home.page.layout" instead of 
> "knowledge.home.page.layout" it works... It finds the 
> "home.page.layout" definition defined in the tiles-homepage-defs.xml 
> file and displays it. The other thing I tried was changing the 
> struts-knowledge-config.xml so that the knowledge servlet forwards to 
> "knowledge.home.page.layout". This works also so I'm assuming that the 
> "knowledge.home.page.layout" definition IS getting initialized via the 
> plugin, but for some reason is not being used when I leave things as 
> they are in the attached xml files.
>
>
> Any clues on what I'm doing wrong would be greatly appreciated.
>
> Thanks, aj
>
>------------------------------------------------------------------------
>
><?xml version="1.0" encoding="ISO-8859-1"?>
>
><!DOCTYPE web-app
>  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>  "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
>
><web-app>
>
><!-- Action Servlet Configuration -->
>  <servlet>
>    <servlet-name>action</servlet-name>
>    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
  
>	
>
>    <!-- Struts configuration -->
>    <init-param>
>      <param-name>config</param-name>
>      <param-value>/WEB-INF/config/struts-homepage-config.xml</param-value>
>    </init-param>
>    <init-param>
>      <param-name>config/knowledge</param-name>
>      <param-value>/WEB-INF/config/struts-knowledge-config.xml</param-value>
>    </init-param>
>    <!-- Added as a trick for a bug in Struts -->
>    <init-param>
>      <param-name>application</param-name>
>      <param-value>org.apache.struts.webapp.tiles.dev1-1.ApplicationResources</param-value>
>    </init-param>
>
>    <init-param>
>      <param-name>application</param-name>
>      <param-value>MessageResources</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>
>
>
>  <!-- The Welcome File List -->
>  <welcome-file-list>
>    <welcome-file>index.jsp</welcome-file>
>  </welcome-file-list>
>
>
>  <!-- Struts Tag Library Descriptor -->
>  <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>/WEB-INF/tlds/struts-bean.tld</taglib-uri>
>    <taglib-location>/WEB-INF/tlds/struts-bean.tld</taglib-location>
>  </taglib>
> 
>  <taglib>
>    <taglib-uri>/WEB-INF/tlds/struts-logic.tld</taglib-uri>
>    <taglib-location>/WEB-INF/tlds/struts-logic.tld</taglib-location>
>  </taglib>
> 
>  <taglib>
>    <taglib-uri>/WEB-INF/tlds/struts-html.tld</taglib-uri>
>    <taglib-location>/WEB-INF/tlds/struts-html.tld</taglib-location>
>  </taglib>
> 
></web-app>
>  
>
>------------------------------------------------------------------------
>
><?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-bean  name="problemForm"
>                type="com.sun.eras.shared.form.ProblemForm"/>
>  </form-beans>
>
>
><!-- ========== Action Mapping Definitions =============== -->
>  <action-mappings>
>    <action path="/homePage"
>            type="com.sun.eras.homepage.action.HomePageAction"
>            name="problemForm"
>            scope="request"
>            validate="false">
>      <forward name="success" path="home.page"/>
>    </action>
>  </action-mappings>
>
>
><!-- ========== Associated Tiles plugin =================== -->
>  <plug-in className="org.apache.struts.tiles.TilesPlugin" >
>    <set-property property="definitions-config"
>                  value="/WEB-INF/config/tiles-defs.xml,
>                         /WEB-INF/config/tiles-homepage-defs.xml" />
>    <set-property property="moduleAware"
>                  value="true" />
>  </plug-in>
>
></struts-config>
>  
>
>------------------------------------------------------------------------
>
><?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-bean  name="problemForm"
>                type="com.sun.eras.shared.form.ProblemForm"/>
>  </form-beans>
>
>
><!-- ========== Action Mapping Definitions ================ -->
>  <action-mappings>
>    <action path="/homePage"
>            type="com.sun.eras.knowledge.action.HomePageAction"
>            name="problemForm"
>            scope="request"
>            validate="false">
>      <forward name="success" path="knowledge.home.page"/>
>    </action>
>  </action-mappings>
>
>
><!-- ========== Associated Tiles plugin =================== -->
>  <plug-in className="org.apache.struts.tiles.TilesPlugin" >
>    <set-property property="definitions-config"
>                  value="/WEB-INF/config/tiles-defs.xml,
>                         /WEB-INF/config/tiles-knowledge-defs.xml" />
>    <set-property property="moduleAware" value="true" />
>  </plug-in>
>
></struts-config>
>  
>
>------------------------------------------------------------------------
>
><!DOCTYPE tiles-definitions PUBLIC
>       "-//Apache Software Foundation//DTD Tiles Configuration//EN"
>       "http://jakarta.apache.org/struts/dtds/tiles-config.dtd">
>
><tiles-definitions>
>
><!-- Main page layout used as a root for other pages defintion.  -->
>  <definition name="site.mainLayout" path="/shared/layout/mainPageLayout.jsp">
>    <put name="header"    value="/shared/layout/mainPageHeader.jsp" />
>    <put name="titlebar"  value="/shared/layout/mainPageTitleBar.jsp" />
>    <put name="rowlinks"  value="/shared/layout/mainPageRowLinks.jsp" />
>    <put name="spacerbar" value="/shared/layout/mainPageSpacerBar.jsp" />
>    <put name="mainbody"  value="" />
>    <put name="footer"    value="/shared/layout/mainPageFooter.jsp" />
>  </definition>
>
></tiles-definitions>
>  
>
>------------------------------------------------------------------------
>
> <!DOCTYPE tiles-definitions PUBLIC
>       "-//Apache Software Foundation//DTD Tiles Configuration//EN"
>       "http://jakarta.apache.org/struts/dtds/tiles-config.dtd">
>
><!-- Definitions for Tiles documentation   -->
>
><tiles-definitions>
>
>  <definition name="home.page" extends="site.mainLayout" >
>    <put name="mainbody" value="home.page.layout" />
>  </definition>
>
>  <definition name="home.page.layout" path="/shared/layout/homePageBodyLayout.jsp"
>
>    <put name="leftportals"  value="/homepage/leftPortals.jsp" />
>    <put name="bodycontent"  value="/homepage/home.jsp" />
>    <put name="rightportals" value="/homepage/rightPortals.jsp" />
>  </definition>
>
></tiles-definitions>
>  
>
>------------------------------------------------------------------------
>
> <!DOCTYPE tiles-definitions PUBLIC
>       "-//Apache Software Foundation//DTD Tiles Configuration//EN"
>       "http://jakarta.apache.org/struts/dtds/tiles-config.dtd">
>
><!-- Definitions for Tiles documentation   -->
>
><tiles-definitions>
>
>  <definition name="knowledge.home.page" extends="site.mainLayout" >
>    <put name="mainbody" value="knowledge.home.page.layout" />
>  </definition>
>
>  <definition name="knowledge.home.page.layout" path="/shared/layout/homePageBodyLayout.jsp"
>
>    <put name="leftportals"  value="/knowledge/leftPortals.jsp" />
>    <put name="bodycontent"  value="/knowledge/home.jsp" />
>    <put name="rightportals" value="/knowledge/rightPortals.jsp" />
>  </definition>
>
></tiles-definitions>
>
>  
>
>------------------------------------------------------------------------
>
>--
>To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message