Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: Tiles 2 - How to dispatch to tiles servlet????

David H. DeWolf

2006-12-05

Replies:

Moving to Struts Users list, please reply there.

Antonio Petrelli wrote:
> First of all this is a typical question to be submitted in Struts Users
> mailing list.
> Anyway, since Tiles 2 is under development, I will answer anyway.
>
> Stone, Sam ha scritto:
>> I can instantiate the DefinitionsFactory. I can get a
>> ComponentDefinition OK. I cannot figure out how to forward the request
>> from MyServlet to dispatch to my tiles servlet. Any help is greatly
>> appreciated.
>>  
> Err... you can't, since TilesServlet does not accept connections (it is
> used without a servlet-mapping).
> Anyway you can forward to (or include) your definition.
>
> <snip>
>   ComponentContext context =
> TilesAccess.getContainer(request.getSession().getServletContext())
>        .render(request, response, "my.definition.name");
> </snip>

Just to avoid confusion, I don't think Antonio meant to imply that the
Container.render returns a ComponentContext.

TilesContainer tc = TilesAccess.getContainer(servletContext)
ComponentContext context = tc.getComponentContext(req, res);
// do something with the component context if needed,
tc.render(req, res, "my.definition.name");


David

>
> HTH
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@(protected)
> For additional commands, e-mail: dev-help@(protected)
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.