struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Domingo A. Rodriguez S." <domingorodrig...@yahoo.com>
Subject Re: Dynamic Tiles?
Date Thu, 08 Jan 2004 21:17:22 GMT

I definitively agree with that answer :P

 --- Pedro Salgado <salgado.pc@04web.com> escribió: > 
> Here goes a response to your question...
> 
> Pedro Salgado
> 
> --------- PREVIOUS MESSAGE (on this mailing list)
> 
> 
> Hi Robert..
> 
> I guess you could achieve the same using the controllerClass attribute
> and
> building your class.. For instance, I have this definition in the
> tiles-defs.xml file:
> ---
>    <definition name=".layout"
>                path="/common/layout.jsp"
>     controllerClass='com.dars.XTileAction'>
>      <put name="title"       value="Encabezado primario"/>
>      <put name="leftside"    value="/common/leftside.jsp"/>
>      <put name="rightside"   value="/common/rightside.jsp"/>
>      <put name="header"      value="/common/header.jsp"/>
>      <put name="footer"      value="/common/footer.jsp"/>
>      <put name="body"        value="/common/body.jsp"/>
>    </definition>
> ---
>   And I have this controllerClass
> ---
> package com.dars;
> import org.apache.struts.tiles.actions.TilesAction;
> import org.apache.struts.tiles.ComponentContext;
> import org.apache.struts.tiles.Controller;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> import javax.servlet.ServletContext;
> import javax.servlet.ServletException;
> import java.io.IOException;
> 
> public class XTileAction extends TilesAction implements Controller{
>     public void perform(ComponentContext tilesctx,
>                         HttpServletRequest request,
>                         HttpServletResponse response,
>                         ServletContext servctx)
>                         throws ServletException, IOException{
>  /* GetAttributes */
>              String titulo= (String)tilesctx.getAttribute("title");
>              String derecha= (String)tilesctx.getAttribute("rightside");
>  /* GetAttributes */
>              System.out.println("  Titulo: "+titulo);
>              System.out.println(" Derecha: "+derecha);
>  /* SetAttributes */
>            tilesctx.putAttribute("title", "Titulo nuevo de esta
> vaina..");
>            tilesctx.putAttribute("rightside", "/common/footer.jsp");
>  /* SetAttributes */
>     }
> }
> ---
> You can change the values of those attributes at runtime. I prefer to do
> it using this method.
> 
> Atte.
> Domingo A. Rodriguez S.
> 
> 
>  --- Robert Taylor <rtaylor@mulework.com> escribió: > Greetings, I have
> a
> tiles definition in my tiles-defs.xml similar to
> > below:
> > 
> >  <definition name="search" extends="layout">
> >     <put name="heading" value="{0}Search" type="string" />
> >     <put name="content" value="/search.jsp" type="page" />
> >   </definition>
> > 
> > which I would like to be able to modify the "heading" value such that
> > at runtime I could substitute a value for {0}.
> > 
> > For example, it would be ideal to use a JSTL type of syntax such as:
> > 
> > <definition name="search" extends="layout">
> >     <put name="heading" value="${param.myValue}Search" type="string"
> />
> >     <put name="content" value="/search.jsp" type="page" />
> >   </definition>
> > 
> > but this does not work.
> > 
> > 
> > 
> > robert
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >  
> 
> 
> On 08/01/2004 20:22, "Anderson, James H [IT]"
> <james.h.anderson@citigroup.com> wrote:
> 
> > I'm wondering if Tiles provides support for choosing a Tile
> dynamically,
> > i.e., programatically at runtime.
> > 
> > Our business users have the capability to not only modify include
> files, but
> > to create new include file directories based on client defined data.
> We're
> > looking for a way to support this in Struts.
> > 
> > Thanks.
> > 
> > jim
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>  

_________________________________________________________
Do You Yahoo!?
Información de Estados Unidos y América Latina, en Yahoo! Noticias.
Visítanos en http://noticias.espanol.yahoo.com

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


Mime
View raw message