tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Petrelli" <antonio.petre...@gmail.com>
Subject Re: Access definition name + other proeprties from jsp context
Date Tue, 15 Jul 2008 19:04:02 GMT
Following the discussion into users@

2008/7/15 Stewart Cambridge <stewart.cambridge@gmail.com>:
> Thank you for your suggestion Antonio, but I've already tried that approach,
> and cannot find a way to access the Definition object from the execute()
> method of a ViewPreparer.

Yes, sorry, in fact you have a "parsed" version of a definition, that
is the AttributeContext parameter.

> Perhaps the Definition could be made part of the ViewPreparer interface in
> future?

No, since a preparer can be called without a definition, for example
with <tiles:insertTemplate> tag.

> Regarding which definition, I think that absolutely there is a single
> specific definition at the point when rendering occurs. In fact, this is
> just about the only time you could claim to know what the definition will
> be, as there is can be many definitions using a jsp, and many definitions
> that can use a ViewPreparer, and many definitions that extend another given
> definition; at runtime all of these resolve such that from a given jsp
> PageContext, it makes sense to refer to "the" definition.

I see your point.

> My current solution is this:
> In BasicTilesConfigurer.java (line 564-620 in v2.0.6):
>   private void render(TilesRequestContext request, String definitionName)
>        throws TilesException {
>
>        ...
>        Definition definition = getDefinition(definitionName, request);
>        ...
>
>       * request.getRequestScope().put( "definition", definition );*

Sincerely I don't like this approach, since the definition name is
simply an "id" and I don't see the usefulness of it.
But exactly, why do you need it?

Antonio

Mime
View raw message