You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by nicolas De Loof <ni...@cgey.com> on 2004/03/18 14:11:43 UTC

adding items to list in a tile definition using extension

Hello,

Is it possible when extending a tile definition to ADD some items to an 
existing list (defined by parent tile definition) ?

I would like to do this :
My web pages have a top line that describe flow in app, something like 
this :

    home > catalog > search > result

I'm using a tile definition for this using the <putlist> and <item> 
tags. But I need to set the full list on every definition. I would like 
to use definition extends mecanism to have a "home" tile definition, 
extend it in a "home.catalog", itself extended by a 
"home.catalog.search" and so on. Every tile definition should only have 
to ADD it's item to the existing list.

Is they're a way to do it ?

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


Re: adding items to list in a tile definition using extension

Posted by Axel Groß <ka...@iaeste.at>.
nice traditional solution...
 make the stuff global, then it's sure to be accessible ;)
looks like a good way for toggling any parameters on and off
maybe should do a tile which does this in a generic way
..
just some thoughts..
<definition name="tile:toggle:base" path="toggleOnOffTile.jsp">
 <put name="realExtends" value="tile:base" />
 <putList name="pleaseToggleUs">
     <item name="home" value="yes" />
     <item name="catalog" value="furniture">
 </putList>

<definition name="tile:search-result" extends="tile:toggle:base">
  <put name="currentLocation" value="0.1"/>
 </definition>

On 2004-03-18 at 15:27:07 +0100, nicolas De Loof wrote:
> OK, I've done it another way :
> 
> I put ALL items used in the webapp in a list :
> 
> <definition name="tile:base">
>   <putList name="locations">
>     <item vale="home">
>     <item vale="catalog">
> ...
> 
> and I extend it for every page :
> 
> <definition name="tile:search-result" extends="tile:base">
>  <put name="currentLocation" value="0.1.2"/>
> </definition>
> 
> I use <c:forTokens> to get indexes in "locations" (0, 1 & 2) from 
> currentLocation" and print ${locations[index].value} in the JSP.
> 
> Nico.
> 
> Axel Groß a écrit :
> 
> >On 2004-03-18 at 14:11:43 +0100, nicolas De Loof wrote:
> > 
> >
> >>Hello,
> >>
> >>Is it possible when extending a tile definition to ADD some items to an 
> >>existing list (defined by parent tile definition) ?
> >>   
> >>
> >no, not with the current tiles implementation 
> >i posted a generic request for solving this a while ago, but didnt get much
> >answers to it (maybe I should repost)
> >
> > 
> >
> >>I would like to do this :
> >>My web pages have a top line that describe flow in app, something like 
> >>this :
> >>
> >>  home > catalog > search > result
> >>
> >>I'm using a tile definition for this using the <putlist> and <item> 
> >>tags. But I need to set the full list on every definition. I would like 
> >>to use definition extends mecanism to have a "home" tile definition, 
> >>extend it in a "home.catalog", itself extended by a 
> >>"home.catalog.search" and so on. Every tile definition should only have 
> >>to ADD it's item to the existing list.
> >>
> >>Is they're a way to do it ?
> >>   
> >>
> >suppose you should use another tiles:putList for each of the following
> >extensions and treat the values of them like they were in just one list.
> >but its evil! should be already in tiles ;)
> >also you have to decide if want to be able to override old items (then you
> >just have to implement it)
> >
> >i.e. (without markup :)
> >definition name="justOne"
> >putList name="bla1"
> > item name="itemX" value="valueX"
> > ...
> >
> >definition name="alreadyTwo" extends="justOne"
> >putList name="bla2"
> > item name="itemY" value="valueY"
> > ...
> >
> >when using it search for blaN until you don't find that blaN anymor (using
> >logic:iterate and logic:exists and/or EL syntax)
> >
> >
> > 
> >
> >>---------------------------------------------------------------------
> >>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
> >
> > 
> >
> 
> ---------------------------------------------------------------------
> 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


Re: adding items to list in a tile definition using extension

Posted by nicolas De Loof <ni...@cgey.com>.
OK, I've done it another way :

I put ALL items used in the webapp in a list :

<definition name="tile:base">
   <putList name="locations">
     <item vale="home">
     <item vale="catalog">
...

and I extend it for every page :

<definition name="tile:search-result" extends="tile:base">
  <put name="currentLocation" value="0.1.2"/>
</definition>

I use <c:forTokens> to get indexes in "locations" (0, 1 & 2) from 
currentLocation" and print ${locations[index].value} in the JSP.

Nico.

Axel Groß a écrit :

>On 2004-03-18 at 14:11:43 +0100, nicolas De Loof wrote:
>  
>
>>Hello,
>>
>>Is it possible when extending a tile definition to ADD some items to an 
>>existing list (defined by parent tile definition) ?
>>    
>>
>no, not with the current tiles implementation 
>i posted a generic request for solving this a while ago, but didnt get much
> answers to it (maybe I should repost)
>
>  
>
>>I would like to do this :
>>My web pages have a top line that describe flow in app, something like 
>>this :
>>
>>   home > catalog > search > result
>>
>>I'm using a tile definition for this using the <putlist> and <item> 
>>tags. But I need to set the full list on every definition. I would like 
>>to use definition extends mecanism to have a "home" tile definition, 
>>extend it in a "home.catalog", itself extended by a 
>>"home.catalog.search" and so on. Every tile definition should only have 
>>to ADD it's item to the existing list.
>>
>>Is they're a way to do it ?
>>    
>>
>suppose you should use another tiles:putList for each of the following
>extensions and treat the values of them like they were in just one list.
>but its evil! should be already in tiles ;)
>also you have to decide if want to be able to override old items (then you
>just have to implement it)
>
>i.e. (without markup :)
>definition name="justOne"
>putList name="bla1"
>  item name="itemX" value="valueX"
>  ...
>
>definition name="alreadyTwo" extends="justOne"
>putList name="bla2"
>  item name="itemY" value="valueY"
>  ...
>
>when using it search for blaN until you don't find that blaN anymor (using
>logic:iterate and logic:exists and/or EL syntax)
>
>
>  
>
>>---------------------------------------------------------------------
>>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
>
>  
>

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


Re: adding items to list in a tile definition using extension

Posted by Axel Groß <ka...@iaeste.at>.
On 2004-03-18 at 14:11:43 +0100, nicolas De Loof wrote:
> Hello,
> 
> Is it possible when extending a tile definition to ADD some items to an 
> existing list (defined by parent tile definition) ?
no, not with the current tiles implementation 
i posted a generic request for solving this a while ago, but didnt get much
 answers to it (maybe I should repost)

> 
> I would like to do this :
> My web pages have a top line that describe flow in app, something like 
> this :
> 
>    home > catalog > search > result
> 
> I'm using a tile definition for this using the <putlist> and <item> 
> tags. But I need to set the full list on every definition. I would like 
> to use definition extends mecanism to have a "home" tile definition, 
> extend it in a "home.catalog", itself extended by a 
> "home.catalog.search" and so on. Every tile definition should only have 
> to ADD it's item to the existing list.
> 
> Is they're a way to do it ?
suppose you should use another tiles:putList for each of the following
extensions and treat the values of them like they were in just one list.
but its evil! should be already in tiles ;)
also you have to decide if want to be able to override old items (then you
just have to implement it)

i.e. (without markup :)
definition name="justOne"
putList name="bla1"
  item name="itemX" value="valueX"
  ...

definition name="alreadyTwo" extends="justOne"
putList name="bla2"
  item name="itemY" value="valueY"
  ...

when using it search for blaN until you don't find that blaN anymor (using
logic:iterate and logic:exists and/or EL syntax)


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