struts-user mailing list archives

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

  Which Struts version do you use ? Try with the latest nightly build or 
the 1.1b3.
  Also, the log of the struts servlet should report a message for each 
module factory loaded. Check it to see if all is right or not.
 
    Cedric

ajTreece wrote:

> Thanks Cedric for replying...
>
> Here is what is happening and I'm not convinced that it is how it 
> should work....
>
> I have two modules A and B (for simplicity). They are defined in 
> web.xml as follows:
>
> <init-param>
>   <param-name>config</param-name>
>   <param-value>/WEB-INF/config/struts-A-config.xml</param-value>
> </init-param>
> <init-param>
>   <param-name>config/B</param-name>
>   <param-value>/WEB-INF/config/struts-B-config.xml</param-value>
> </init-param>
>
> I have (at this time) three tiles defs files... COMMON, A, and B. The 
> COMMON defs handle the main page layout and other tiles common to all 
> modules for this site. Tiles defs A and B are specific to that 
> particular module. Here is how they are defined in each module xml 
> file which is not working:
>
> ...struts-A-config.xml...
> <plug-in className="org.apache.struts.tiles.TilesPlugin" >
>   <set-property property="definitions-config"
>                      value="/WEB-INF/config/tiles-COMMON-defs.xml,
>                                 /WEB-INF/config/tiles-A-defs.xml" />
>   <set-property property="moduleAware" value="true" />
> </plug-in>
>
> ...struts-B-config.xml...
> <plug-in className="org.apache.struts.tiles.TilesPlugin" >
>   <set-property property="definitions-config"
>                      value="/WEB-INF/config/tiles-COMMON-defs.xml,
>                                 /WEB-INF/config/tiles-B-defs.xml" />
>   <set-property property="moduleAware" value="true" />
> </plug-in>
>
>
> The only way I can get the tiles to display correctly is if I include 
> B's tiles defs in the module A's plugin as follows:
>
>  ...struts-A-config.xml...
> <plug-in className="org.apache.struts.tiles.TilesPlugin" >
>   <set-property property="definitions-config"
>                      value="/WEB-INF/config/tiles-COMMON-defs.xml,
>                                 /WEB-INF/config/tiles-A-defs.xml,
>                                 /WEB-INF/config/tiles-B-defs.xml" />
>   <set-property property="moduleAware" value="true" />
> </plug-in>
>
> Also note, that module B's plugin must still include both the COMMON 
> and B's tiles defs to work. It is almost acting like ALL of the tiles 
> defs need to be initialized via first plugin accessed via web.xml. Is 
> there something wrong or is that the way it is suppose to work?
>
> Thanks again, aj
>
>
>
> Cedric Dumoulin wrote:
>
>>
>>
>> ajTreece wrote:
>>
>>> Folks.... Just for grins, I tried something different.... I 
>>> basically have two struts-config.xml files (one for each module) and 
>>> in each I call the plugin to load the tiles factory required. Just 
>>> to see what would happen I included ALL of my tiles-*-defs.xml files 
>>> in the definitions-config property  for each struts-*-config.xml and 
>>> low and behold the desired tile layout displayed for each page.
>>>  
>>
>>
>>
>>>
>>> Am I reading the books / docs incorrectly? I am assuming that each 
>>> application module could have it's own unique and private tiles 
>>> definitions files. What "seems" to be happening is that ALL of my 
>>> tiles definitions need to be initialized via the plugin in the 
>>> struts config file.
>>
>>
>>
>>  Yes, each module have its own definitions file when moduleAware="true".
>>  Can you check the servlet logs to see if there is one or two factory 
>> loaded ?
>>
>>>
>>> Has anyone else had success using multiple application modules with 
>>> individual tiles definitions?
>>
>>
>>
>>   Yes, me ;-). The tiles-documentation.war use modules with different 
>> tiles config file.
>>
>>    Cedric
>>
>>>
>>>
>>> Thanks aj
>>>
>>>
>>>
>>> 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>
>>>
>>>
>>
>>
>> -- 
>> 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>
>
>


--
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