You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Lou Morin <lm...@tarponweb.com> on 2002/10/03 05:40:59 UTC

How do you pass a variable controllerClass name to the classicLayout.jsp in Tiles?

I'm trying to pass the "controller" name from the tiles definition to the classicLayout.jsp.
The value does get passed to classicLayout.jsp ... but, the <tiles:insert> tag has a problem with it
because the  <%=myController%> does not get substituded ... does anybody know how to get around this problem?

Thanks,
Lou


- In tiles-def.xml:

  <definition name="ysw.mainLayout" path="/layouts/classicLayout.jsp">
   <put name="title"  value="Testing Title" />
   <put name="header" value="/tiles/common/header.jsp" />
   <put name="menu"   value="ysw.menu.bar" />
   <put name="body"   value="/jsp/welcome.jsp" />
   <put name="footer" value="/tiles/common/footer.jsp" />
   <put name="controller" value="com.ysw.admin.MyTileController" />
  </definition>
   


- In classicLayout.jsp:

   <logic:present name="controller">
     <tiles:useAttribute id="myController" name="controller" classname="java.lang.String"/>
     <tiles:insert attribute='body'  controllerClass="<%=myController%>">
     </tiles:insert>
   </logic:present>

   <logic:notPresent name="controller" >
     <tiles:insert attribute='body'>
     </tiles:insert>
   </logic:notPresent>


Re: How do you pass a variable controllerClass name to the classicLayout.jsp in Tiles?

Posted by Cedric Dumoulin <ce...@apache.org>.
 It is because the controllerClass  attribute is not specified as 
"rtexpr" in the tiles tld file. You can change the declaration to true 
and it should work. This is probably a bug !

Cedric

Lou Morin wrote:

>I'm trying to pass the "controller" name from the tiles definition to the classicLayout.jsp.
>The value does get passed to classicLayout.jsp ... but, the <tiles:insert> tag has a problem with it
>because the  <%=myController%> does not get substituded ... does anybody know how to get around this problem?
>
>Thanks,
>Lou
>
>
>- In tiles-def.xml:
>
>  <definition name="ysw.mainLayout" path="/layouts/classicLayout.jsp">
>   <put name="title"  value="Testing Title" />
>   <put name="header" value="/tiles/common/header.jsp" />
>   <put name="menu"   value="ysw.menu.bar" />
>   <put name="body"   value="/jsp/welcome.jsp" />
>   <put name="footer" value="/tiles/common/footer.jsp" />
>   <put name="controller" value="com.ysw.admin.MyTileController" />
>  </definition>
>   
>
>
>- In classicLayout.jsp:
>
>   <logic:present name="controller">
>     <tiles:useAttribute id="myController" name="controller" classname="java.lang.String"/>
>     <tiles:insert attribute='body'  controllerClass="<%=myController%>">
>     </tiles:insert>
>   </logic:present>
>
>   <logic:notPresent name="controller" >
>     <tiles:insert attribute='body'>
>     </tiles:insert>
>   </logic:notPresent>
>
>
>  
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>