You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Affan Qureshi <qu...@etilize.com> on 2002/11/05 15:20:20 UTC

Re: [TILES] Dynamically overriding Tiles Definitions

I want to modify the Attributes in a tiles Definition from my Action
classes. Is this possible? I have tried the following code inside the Action
class but do not get an Attribute against the name, instead I get a null.

    ComponentContext context = ComponentContext.getContext(request);
    java.util.List list = (java.util.List)context.getAttribute("tabList");

Is it because it is request scoped? Can i make it session-scoped? Also I get
an empty iterator when I try to traverse the list of attributes in the Tiles
Context.

    Iterator iter = context.getAttributeNames();
    System.out.println(iter.next())
    System.out.print("Printing Attrbutes:");
    while(iter.hasNext())
    {
        System.out.println("Attribute"+ ((String)iter.next()));
    }

My tiles definition is given below. Thanks a lot.

----- Original Message -----
From: "Affan Qureshi" <qu...@etilize.com>
To: "struts-user" <st...@jakarta.apache.org>
Sent: Tuesday, November 05, 2002 1:26 PM
Subject: Nested layouts (Panels inside Tabs)



> I have a Tabs Layout setup and inside a tab I have another layout with two
> panels(menu and content). This is my definition:
>
> <definition name="index.page" path="/webpages/layouts/tabsLayout.jsp" >
>      <put name="header" value="/webpages/header.jsp"/>
>      <put name="footer" value="/webpages/footer.jsp" />dfs
>      <put name="selectedIndex" value="0" />s
>      <put name="parameterName" value="selected" />
>      <putList name="tabList" >
>          <item value="Home"  link="/webpages/home.jsp"
> classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
>          <item value="Template"  link="/webpages/template.jsp"
> classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
>          <item value="Search" link="/webpages/search.jsp"
> classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
>  </putList>
> </definition>
>
> The link to "Template" i.e the template.jsp file follows a simple layout:
>
> <definition name="templateview.default" path="/webpages/layout.jsp">
>     <put name="menu" value="/webpages/tiles/categoryTile.jsp"/>
>     <put name="body" value="/webpages/tiles/templateTile.jsp"/>
> </definition>
>
> The problem is that when I click on any link inside one of the panels in
> templateTile.jsp or any other file, it breaks out of the Tabular layout
and
> displays it as just two panels. This problem can be reproduced if you run
> the tiles-documentation example and go to
> http://localhost:8080/tiles-documentation/examples/tabs.jsp. Now here if
you
> click on any link in the menu the page will open outside the tab layout.
>
> The hyperlinks in my "Menu" panel point to Action classes. I am forwarding
> requests from the Action classes to Tiles Definitions.
>
> What should I do to tackle this problem?
>
> Also can anyone guide me to a resource for Nested Tabs?
>
> Thanks for your time.


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


Re: [TILES] Dynamically overriding Tiles Definitions

Posted by Cedric Dumoulin <ce...@apache.org>.

Affan Qureshi wrote:

>Thanks. I got the attributes form the Tiles Context but only on the JSP that
>had a <tiles:insert>. Can I somehow make the Tiles Definition session
>scoped? Also in case of nested Tiles, will there be multiple Tile Contexts?
>

  Definitions declared in the configuration file belong to the 
definition factory which is in the application scope. You can create 
yourself and store definitions in any jsp scope like a regular java 
bean. You insert it with <tiles:insert name="defName" 
scope="page|request|session|application" />.
  In the case of nested tiles, there is one different context for each 
nested tiles.

        Cedric

>
>Affan
>----- Original Message -----
>From: "Cedric Dumoulin" <ce...@apache.org>
>To: "Struts Users Mailing List" <st...@jakarta.apache.org>
>Sent: Tuesday, November 05, 2002 9:11 PM
>Subject: Re: [TILES] Dynamically overriding Tiles Definitions
>
>
>  
>
>>  Hi,
>>
>>  Where is declared your action ? To be able to retrieve the tiles
>>context, there should be a tiles context. There is a tiles context only
>>if you insert an Tiles, or do a forward from an action to a definition.
>>In this later case, the context is created after the action.
>>
>>          Cedric
>>
>>Affan Qureshi wrote:
>>
>>    
>>
>>>I want to modify the Attributes in a tiles Definition from my Action
>>>classes. Is this possible? I have tried the following code inside the
>>>      
>>>
>Action
>  
>
>>>class but do not get an Attribute against the name, instead I get a null.
>>>
>>>   ComponentContext context = ComponentContext.getContext(request);
>>>   java.util.List list =
>>>      
>>>
>(java.util.List)context.getAttribute("tabList");
>  
>
>>>Is it because it is request scoped? Can i make it session-scoped? Also I
>>>      
>>>
>get
>  
>
>>>an empty iterator when I try to traverse the list of attributes in the
>>>      
>>>
>Tiles
>  
>
>>>Context.
>>>
>>>   Iterator iter = context.getAttributeNames();
>>>   System.out.println(iter.next())
>>>   System.out.print("Printing Attrbutes:");
>>>   while(iter.hasNext())
>>>   {
>>>       System.out.println("Attribute"+ ((String)iter.next()));
>>>   }
>>>
>>>My tiles definition is given below. Thanks a lot.
>>>
>>>----- Original Message -----
>>>From: "Affan Qureshi" <qu...@etilize.com>
>>>To: "struts-user" <st...@jakarta.apache.org>
>>>Sent: Tuesday, November 05, 2002 1:26 PM
>>>Subject: Nested layouts (Panels inside Tabs)
>>>
>>>
>>>
>>>
>>>
>>>      
>>>
>>>>I have a Tabs Layout setup and inside a tab I have another layout with
>>>>        
>>>>
>two
>  
>
>>>>panels(menu and content). This is my definition:
>>>>
>>>><definition name="index.page" path="/webpages/layouts/tabsLayout.jsp" >
>>>>    <put name="header" value="/webpages/header.jsp"/>
>>>>    <put name="footer" value="/webpages/footer.jsp" />dfs
>>>>    <put name="selectedIndex" value="0" />s
>>>>    <put name="parameterName" value="selected" />
>>>>    <putList name="tabList" >
>>>>        <item value="Home"  link="/webpages/home.jsp"
>>>>classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
>>>>        <item value="Template"  link="/webpages/template.jsp"
>>>>classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
>>>>        <item value="Search" link="/webpages/search.jsp"
>>>>classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
>>>></putList>
>>>></definition>
>>>>
>>>>The link to "Template" i.e the template.jsp file follows a simple
>>>>        
>>>>
>layout:
>  
>
>>>><definition name="templateview.default" path="/webpages/layout.jsp">
>>>>   <put name="menu" value="/webpages/tiles/categoryTile.jsp"/>
>>>>   <put name="body" value="/webpages/tiles/templateTile.jsp"/>
>>>></definition>
>>>>
>>>>The problem is that when I click on any link inside one of the panels in
>>>>templateTile.jsp or any other file, it breaks out of the Tabular layout
>>>>
>>>>
>>>>        
>>>>
>>>and
>>>
>>>
>>>      
>>>
>>>>displays it as just two panels. This problem can be reproduced if you
>>>>        
>>>>
>run
>  
>
>>>>the tiles-documentation example and go to
>>>>http://localhost:8080/tiles-documentation/examples/tabs.jsp. Now here if
>>>>
>>>>
>>>>        
>>>>
>>>you
>>>
>>>
>>>      
>>>
>>>>click on any link in the menu the page will open outside the tab layout.
>>>>
>>>>The hyperlinks in my "Menu" panel point to Action classes. I am
>>>>        
>>>>
>forwarding
>  
>
>>>>requests from the Action classes to Tiles Definitions.
>>>>
>>>>What should I do to tackle this problem?
>>>>
>>>>Also can anyone guide me to a resource for Nested Tabs?
>>>>
>>>>Thanks for your time.
>>>>
>>>>
>>>>        
>>>>
>>>--
>>>To unsubscribe, e-mail:
>>>      
>>>
><ma...@jakarta.apache.org>
>  
>
>>>For additional commands, e-mail:
>>>      
>>>
><ma...@jakarta.apache.org>
>  
>
>>>
>>>
>>>      
>>>
>>--
>>To unsubscribe, e-mail:
>>    
>>
><ma...@jakarta.apache.org>
>  
>
>>For additional commands, e-mail:
>>    
>>
><ma...@jakarta.apache.org>
>  
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>  
>


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


Re: [TILES] Dynamically overriding Tiles Definitions

Posted by Affan Qureshi <qu...@etilize.com>.
Thanks. I got the attributes form the Tiles Context but only on the JSP that
had a <tiles:insert>. Can I somehow make the Tiles Definition session
scoped? Also in case of nested Tiles, will there be multiple Tile Contexts?

Affan
----- Original Message -----
From: "Cedric Dumoulin" <ce...@apache.org>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Tuesday, November 05, 2002 9:11 PM
Subject: Re: [TILES] Dynamically overriding Tiles Definitions


>
>   Hi,
>
>   Where is declared your action ? To be able to retrieve the tiles
> context, there should be a tiles context. There is a tiles context only
> if you insert an Tiles, or do a forward from an action to a definition.
> In this later case, the context is created after the action.
>
>           Cedric
>
> Affan Qureshi wrote:
>
> >I want to modify the Attributes in a tiles Definition from my Action
> >classes. Is this possible? I have tried the following code inside the
Action
> >class but do not get an Attribute against the name, instead I get a null.
> >
> >    ComponentContext context = ComponentContext.getContext(request);
> >    java.util.List list =
(java.util.List)context.getAttribute("tabList");
> >
> >Is it because it is request scoped? Can i make it session-scoped? Also I
get
> >an empty iterator when I try to traverse the list of attributes in the
Tiles
> >Context.
> >
> >    Iterator iter = context.getAttributeNames();
> >    System.out.println(iter.next())
> >    System.out.print("Printing Attrbutes:");
> >    while(iter.hasNext())
> >    {
> >        System.out.println("Attribute"+ ((String)iter.next()));
> >    }
> >
> >My tiles definition is given below. Thanks a lot.
> >
> >----- Original Message -----
> >From: "Affan Qureshi" <qu...@etilize.com>
> >To: "struts-user" <st...@jakarta.apache.org>
> >Sent: Tuesday, November 05, 2002 1:26 PM
> >Subject: Nested layouts (Panels inside Tabs)
> >
> >
> >
> >
> >
> >>I have a Tabs Layout setup and inside a tab I have another layout with
two
> >>panels(menu and content). This is my definition:
> >>
> >><definition name="index.page" path="/webpages/layouts/tabsLayout.jsp" >
> >>     <put name="header" value="/webpages/header.jsp"/>
> >>     <put name="footer" value="/webpages/footer.jsp" />dfs
> >>     <put name="selectedIndex" value="0" />s
> >>     <put name="parameterName" value="selected" />
> >>     <putList name="tabList" >
> >>         <item value="Home"  link="/webpages/home.jsp"
> >>classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
> >>         <item value="Template"  link="/webpages/template.jsp"
> >>classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
> >>         <item value="Search" link="/webpages/search.jsp"
> >>classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
> >> </putList>
> >></definition>
> >>
> >>The link to "Template" i.e the template.jsp file follows a simple
layout:
> >>
> >><definition name="templateview.default" path="/webpages/layout.jsp">
> >>    <put name="menu" value="/webpages/tiles/categoryTile.jsp"/>
> >>    <put name="body" value="/webpages/tiles/templateTile.jsp"/>
> >></definition>
> >>
> >>The problem is that when I click on any link inside one of the panels in
> >>templateTile.jsp or any other file, it breaks out of the Tabular layout
> >>
> >>
> >and
> >
> >
> >>displays it as just two panels. This problem can be reproduced if you
run
> >>the tiles-documentation example and go to
> >>http://localhost:8080/tiles-documentation/examples/tabs.jsp. Now here if
> >>
> >>
> >you
> >
> >
> >>click on any link in the menu the page will open outside the tab layout.
> >>
> >>The hyperlinks in my "Menu" panel point to Action classes. I am
forwarding
> >>requests from the Action classes to Tiles Definitions.
> >>
> >>What should I do to tackle this problem?
> >>
> >>Also can anyone guide me to a resource for Nested Tabs?
> >>
> >>Thanks for your time.
> >>
> >>
> >
> >
> >--
> >To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> >For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
> >
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


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


Re: [TILES] Dynamically overriding Tiles Definitions

Posted by Cedric Dumoulin <ce...@apache.org>.
  Hi,

  Where is declared your action ? To be able to retrieve the tiles 
context, there should be a tiles context. There is a tiles context only 
if you insert an Tiles, or do a forward from an action to a definition. 
In this later case, the context is created after the action.

          Cedric

Affan Qureshi wrote:

>I want to modify the Attributes in a tiles Definition from my Action
>classes. Is this possible? I have tried the following code inside the Action
>class but do not get an Attribute against the name, instead I get a null.
>
>    ComponentContext context = ComponentContext.getContext(request);
>    java.util.List list = (java.util.List)context.getAttribute("tabList");
>
>Is it because it is request scoped? Can i make it session-scoped? Also I get
>an empty iterator when I try to traverse the list of attributes in the Tiles
>Context.
>
>    Iterator iter = context.getAttributeNames();
>    System.out.println(iter.next())
>    System.out.print("Printing Attrbutes:");
>    while(iter.hasNext())
>    {
>        System.out.println("Attribute"+ ((String)iter.next()));
>    }
>
>My tiles definition is given below. Thanks a lot.
>
>----- Original Message -----
>From: "Affan Qureshi" <qu...@etilize.com>
>To: "struts-user" <st...@jakarta.apache.org>
>Sent: Tuesday, November 05, 2002 1:26 PM
>Subject: Nested layouts (Panels inside Tabs)
>
>
>
>  
>
>>I have a Tabs Layout setup and inside a tab I have another layout with two
>>panels(menu and content). This is my definition:
>>
>><definition name="index.page" path="/webpages/layouts/tabsLayout.jsp" >
>>     <put name="header" value="/webpages/header.jsp"/>
>>     <put name="footer" value="/webpages/footer.jsp" />dfs
>>     <put name="selectedIndex" value="0" />s
>>     <put name="parameterName" value="selected" />
>>     <putList name="tabList" >
>>         <item value="Home"  link="/webpages/home.jsp"
>>classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
>>         <item value="Template"  link="/webpages/template.jsp"
>>classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
>>         <item value="Search" link="/webpages/search.jsp"
>>classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
>> </putList>
>></definition>
>>
>>The link to "Template" i.e the template.jsp file follows a simple layout:
>>
>><definition name="templateview.default" path="/webpages/layout.jsp">
>>    <put name="menu" value="/webpages/tiles/categoryTile.jsp"/>
>>    <put name="body" value="/webpages/tiles/templateTile.jsp"/>
>></definition>
>>
>>The problem is that when I click on any link inside one of the panels in
>>templateTile.jsp or any other file, it breaks out of the Tabular layout
>>    
>>
>and
>  
>
>>displays it as just two panels. This problem can be reproduced if you run
>>the tiles-documentation example and go to
>>http://localhost:8080/tiles-documentation/examples/tabs.jsp. Now here if
>>    
>>
>you
>  
>
>>click on any link in the menu the page will open outside the tab layout.
>>
>>The hyperlinks in my "Menu" panel point to Action classes. I am forwarding
>>requests from the Action classes to Tiles Definitions.
>>
>>What should I do to tackle this problem?
>>
>>Also can anyone guide me to a resource for Nested Tabs?
>>
>>Thanks for your time.
>>    
>>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>  
>


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