Hello,

  See intermixed.

    Cedric

Rajesh Kalluri wrote:

> Hi all i am using tiles as a templating mechanism in my application and like
> the
> controller mechanism a lot.
>
> This is my defintion which will add 3 tiles (add,rank,publish) in a column
> layout.
>
> <definition name="godavari.index.deinteres.body"
> path="/layouts/zonesLayout.jsp"
>   controllerUrl="/godavari/controller/linksSettings.do">
>
>     <put name="add" value="/portal/deinteres/tiles/addLinkTile.jsp" />
>     <put name="rank" value="/portal/deinteres/tiles/deinteresSettings.jsp"
> />
>     <put name="preview" value="/portal/deinteres/tiles/currentDeinteres.jsp"
> />
> </definition>
>
> All three tiles in this definition use the same data coming from the
> controller and disply them in different formats.
>
> i do this in addLinkTile.jsp.
>
> <tiles:importAttribute name="links" />
>
> But my individual files cannot find this data in the component context
> unless i define three seperate defintions and use a column layout to display
> them is there a way to jsut declare the controller once and use in all the
> tiles that are added to a definition. If i use seperate defintions
> controller is called thrice and in real world situations will cause lot of
> over head on the server.
>

  Attribute from a tile are only visible inside this tile (like parameters of a
methods). If you set some attributes in the controller, these attribute are
visible to the tile attached to your controller (here your layout.jsp), not to
tiles inserted by controller. If you want them to be visible, you need to pass
them effectively when you insert (sub-)tiles :
  <tiles:insert attribute="add" >
    <tiles:put name="aName" beanName="aName" beanScope="tile" />
  <tiles:insert/>

  Unfortunately, this imply to modify your layout.
  Another solution is to put your attribute values in the request scope rather
than in the tile context scope. Like this, their will be available in all
inserted tiles.


>
> Any help in this matter from cedric or anyone else will be greatly
> appreciated.
>
> Also is there a way i can change my "preview" tile based on some input from
> the client in the controller if so can anyone post a snippet please.
>

  In the controller you can specify a value for the attribute "preview". In your
case, specify the name of a definition or the url of a page to use.

  Code will look something like :

  // Select preview url according to client choice
   String url = .....
  // Set / override preview value url :
  if(url != null )
tileContext.setAttribute( "preview", url );

>
> Right now in my controller i display different data based on the user input
> in colloboration with a plain action.
>
> Regards
> Rajesh Kalluri
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to