You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stephen Smithstone <sk...@lchost.co.uk> on 2003/04/04 14:33:27 UTC

Tiles problem

Hi all got a problem with a tiles contoller heres the controller code


public class IndexTiles implements org.apache.struts.tiles.Controller {

  public void perform( ComponentContext comCtx , HttpServletRequest req ,
                       HttpServletResponse res , ServletContext serCtx )
  {
    System.out.println( "Processing IndexTiles.." );

    List newStories = new ArrayList( );

    NewStory story = new NewStory( );

    story.setStory( "A New Document Store System is now in place that allows 
sub directories to be assigned to different people" );
    story.setStoryDate( new java.text.SimpleDateFormat( "dd/MM/yyyy" ).format( 
new java.util.Date( )));

    newStories.add( story );


    comCtx.putAttribute( "News" , newStories );
    
    

    Iterator it = comCtx.getAttributeNames();

    while( it.hasNext() )
    {
      System.out.println( it.next().toString() );
    }


  }
}

and in my tiles-defs.xml i have

 <definition name="home.main" extends="main.layout" 
controllerClass="co.uk.oyez.webapps.intranet.home.tiles.IndexTiles">
    <put name="body" value="/home/pages/index.jsp" />
    <put name="heading" value="Intranet - Home" />

how ever on my page index.jsp i have

<tiles:importAttribute name="News"/>

when ever i go to the page is says it cant find News in the context please 
help

Ta






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


Re: Tiles problem

Posted by Cedric Dumoulin <ce...@lifl.fr>.
  Hi,

  Try to use the o.a.s.tiles.actions.DefinitionDispatcherAction instead.

   Cedric


Stephen Smithstone wrote:

>i get to the tile via an org.apache.struts.actions.ForwardAction with 
>home.main as the parameter
>
>
>On Friday 04 April 2003 1:50 pm, Cedric Dumoulin wrote:
>  
>
>>  Hi,
>>
>>  How do you insert your tiles ? Do you use the <tiles:insert
>>name="home.main" > tag, an action <forward name ="home.main" /> or
>>something else ? You should use one of insert or forward.
>>
>>   Cedric
>>
>>Stephen Smithstone wrote:
>>    
>>
>>>Hi all got a problem with a tiles contoller heres the controller code
>>>
>>>
>>>public class IndexTiles implements org.apache.struts.tiles.Controller {
>>>
>>> public void perform( ComponentContext comCtx , HttpServletRequest req ,
>>>                      HttpServletResponse res , ServletContext serCtx )
>>> {
>>>   System.out.println( "Processing IndexTiles.." );
>>>
>>>   List newStories = new ArrayList( );
>>>
>>>   NewStory story = new NewStory( );
>>>
>>>   story.setStory( "A New Document Store System is now in place that
>>>allows sub directories to be assigned to different people" );
>>>   story.setStoryDate( new java.text.SimpleDateFormat( "dd/MM/yyyy"
>>>).format( new java.util.Date( )));
>>>
>>>   newStories.add( story );
>>>
>>>
>>>   comCtx.putAttribute( "News" , newStories );
>>>
>>>
>>>
>>>   Iterator it = comCtx.getAttributeNames();
>>>
>>>   while( it.hasNext() )
>>>   {
>>>     System.out.println( it.next().toString() );
>>>   }
>>>
>>>
>>> }
>>>}
>>>
>>>and in my tiles-defs.xml i have
>>>
>>><definition name="home.main" extends="main.layout"
>>>controllerClass="co.uk.oyez.webapps.intranet.home.tiles.IndexTiles">
>>>   <put name="body" value="/home/pages/index.jsp" />
>>>   <put name="heading" value="Intranet - Home" />
>>>
>>>how ever on my page index.jsp i have
>>>
>>><tiles:importAttribute name="News"/>
>>>
>>>when ever i go to the page is says it cant find News in the context please
>>>help
>>>
>>>Ta
>>>
>>>
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>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: Tiles problem

Posted by Stephen Smithstone <sk...@lchost.co.uk>.
i get to the tile via an org.apache.struts.actions.ForwardAction with 
home.main as the parameter


On Friday 04 April 2003 1:50 pm, Cedric Dumoulin wrote:
>   Hi,
>
>   How do you insert your tiles ? Do you use the <tiles:insert
> name="home.main" > tag, an action <forward name ="home.main" /> or
> something else ? You should use one of insert or forward.
>
>    Cedric
>
> Stephen Smithstone wrote:
> >Hi all got a problem with a tiles contoller heres the controller code
> >
> >
> >public class IndexTiles implements org.apache.struts.tiles.Controller {
> >
> >  public void perform( ComponentContext comCtx , HttpServletRequest req ,
> >                       HttpServletResponse res , ServletContext serCtx )
> >  {
> >    System.out.println( "Processing IndexTiles.." );
> >
> >    List newStories = new ArrayList( );
> >
> >    NewStory story = new NewStory( );
> >
> >    story.setStory( "A New Document Store System is now in place that
> > allows sub directories to be assigned to different people" );
> >    story.setStoryDate( new java.text.SimpleDateFormat( "dd/MM/yyyy"
> > ).format( new java.util.Date( )));
> >
> >    newStories.add( story );
> >
> >
> >    comCtx.putAttribute( "News" , newStories );
> >
> >
> >
> >    Iterator it = comCtx.getAttributeNames();
> >
> >    while( it.hasNext() )
> >    {
> >      System.out.println( it.next().toString() );
> >    }
> >
> >
> >  }
> >}
> >
> >and in my tiles-defs.xml i have
> >
> > <definition name="home.main" extends="main.layout"
> >controllerClass="co.uk.oyez.webapps.intranet.home.tiles.IndexTiles">
> >    <put name="body" value="/home/pages/index.jsp" />
> >    <put name="heading" value="Intranet - Home" />
> >
> >how ever on my page index.jsp i have
> >
> ><tiles:importAttribute name="News"/>
> >
> >when ever i go to the page is says it cant find News in the context please
> >help
> >
> >Ta
> >
> >
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >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: Tiles problem

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

  How do you insert your tiles ? Do you use the <tiles:insert 
name="home.main" > tag, an action <forward name ="home.main" /> or 
something else ? You should use one of insert or forward.

   Cedric

Stephen Smithstone wrote:

>Hi all got a problem with a tiles contoller heres the controller code
>
>
>public class IndexTiles implements org.apache.struts.tiles.Controller {
>
>  public void perform( ComponentContext comCtx , HttpServletRequest req ,
>                       HttpServletResponse res , ServletContext serCtx )
>  {
>    System.out.println( "Processing IndexTiles.." );
>
>    List newStories = new ArrayList( );
>
>    NewStory story = new NewStory( );
>
>    story.setStory( "A New Document Store System is now in place that allows 
>sub directories to be assigned to different people" );
>    story.setStoryDate( new java.text.SimpleDateFormat( "dd/MM/yyyy" ).format( 
>new java.util.Date( )));
>
>    newStories.add( story );
>
>
>    comCtx.putAttribute( "News" , newStories );
>    
>    
>
>    Iterator it = comCtx.getAttributeNames();
>
>    while( it.hasNext() )
>    {
>      System.out.println( it.next().toString() );
>    }
>
>
>  }
>}
>
>and in my tiles-defs.xml i have
>
> <definition name="home.main" extends="main.layout" 
>controllerClass="co.uk.oyez.webapps.intranet.home.tiles.IndexTiles">
>    <put name="body" value="/home/pages/index.jsp" />
>    <put name="heading" value="Intranet - Home" />
>
>how ever on my page index.jsp i have
>
><tiles:importAttribute name="News"/>
>
>when ever i go to the page is says it cant find News in the context please 
>help
>
>Ta
>
>
>
>
>
>
>---------------------------------------------------------------------
>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