You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Trevor Nightingale <Tr...@sas.com> on 2003/03/31 22:59:46 UTC

Using a Tile Definition from within a Servlet ?

Is it possible to "forward" to a tiles definition with a servlet ?

Something like

	RequestDispatcher dispatcher = request.getRequestDispatcher("tile.def.goes.here");
      dispatcher.forward(request,response);


Thank you in advance,
Trevor

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


Re: Using a Tile Definition from within a Servlet ?

Posted by Cedric Dumoulin <ce...@apache.org>.
  Yes, it is possible. There is no simple API to do that, but take a 
look at the TilesRequestProcessor.processTilesDefinition(...) method to 
know how it is done by the struts servlet.
  What you should do is:

    * retrieve the definition from the factory
    * create the new tile context from thedefinition
    * save the current tile context
    * store the new tile context in the jsp context
    * include the new tile
    * restore the current context


   Hope this help,

      Cedric

Trevor Nightingale wrote:

>Is it possible to "forward" to a tiles definition with a servlet ?
>
>Something like
>
>	RequestDispatcher dispatcher = request.getRequestDispatcher("tile.def.goes.here");
>      dispatcher.forward(request,response);
>
>
>Thank you in advance,
>Trevor
>
>---------------------------------------------------------------------
>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