>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?

That's exactly what I do need - the id of the template.
For example, if I'm using a jsp in both a header and a footer, I might want
the jsp to be able to render out a different id for each, for javascript or
css purposes.

One way to achieve this is this way:
<definition name="mytile" ... >
<put-attribute name="id" value="mytile"/>
</definition>

But then I had the thought that the definition name must be accessible in
the jsp page context, so why repeat this boiler plate code over and over.
Then I found that it wasn't...


2008/7/15 Antonio Petrelli <[EMAIL PROTECTED]>:

> Following the discussion into users@
>
> 2008/7/15 Stewart Cambridge <[EMAIL PROTECTED]>:
> > 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
>

Reply via email to