For example, you can have a search input at the top of the page, and a
search input at the bottom of the page.
You can use the same jsp for both, even if they are not 100% identical, by
wrapping them in different tile definitions, with slightly different
attributes.
e.g.
<definition name="search-layout" template="search_box.jsp">
.... default attributes ...
</definition>

<definition name="upper-search" extends="search-layout">
  <put-attribute name="logo" value="large"/>
</definition>

<definition name="lower-search" extends="search-layout">
  <put-attribute name="logo" value="small"/>
</definition>

You might also have some javascript which wants to access the upper search
bar referencing <div id="upper-search">
Or you might have css which is mostly the same but slightly different for
the lower one.

Or you might use the same jsp on different pages, and have different css
apply to it. For example, your menu might go across the top or down the
side, or be a drop down on different pages. Althought the menu tile is the
same, it is wrapped in a div with a different id.

Stewart


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

> 2008/7/16 Stewart Cambridge <[EMAIL PROTECTED]>:
> >>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.
>
> So you use the name of the definition as an id of an item in your
> HTML? I suppose that it is always the same HTML element that will have
> this id, right?
> Can you elaborate on this? In particular, why do you want to give a
> different CSS aspect for the same element, and how do you want to use
> it in JavaScript?
> Usually the ID is fixed in the HTML, eventually you can specify a
> different stylesheet or override the javascript function, not the
> opposite.
>
> Antonio
>

Reply via email to