You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Joe Mathews <te...@yahoo.com> on 2001/03/13 00:17:42 UTC
content map population
I am using template tag library for my project. All
the template files in my project are dynamic.
Is is possible to populate the content map in my
java code and use it along with insert template
Thanks
Joe
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/
Re: content map population
Posted by Cedric Dumoulin <ce...@lifl.fr>.
Incze Lajos wrote:
> On Tue, Mar 13, 2001 at 09:57:36AM +0100, Cedric Dumoulin wrote:
> >
> > Not yet, but in a few days I will provide such facilities for
> > Templates. If you want to know how it will work, I have put an extract
> > of a previous mail at the end of this mail.
> >
> > Cedric
>
> Will be this facility part of the 1.0 struts release or it is for the 1.1
> (not-yet-existent) source tree? incze
I see this facility as a starting point for "extended templates". It is
certainly better to keep actual Templates for 1.0, and put new features, like
this one, in 1.1.
So, maybe the delay will be a little bit longer, but I hope not too much.
Cedric
Re: content map population
Posted by Incze Lajos <in...@mail.matav.hu>.
On Tue, Mar 13, 2001 at 09:57:36AM +0100, Cedric Dumoulin wrote:
>
> Not yet, but in a few days I will provide such facilities for
> Templates. If you want to know how it will work, I have put an extract
> of a previous mail at the end of this mail.
>
> Cedric
Will be this facility part of the 1.0 struts release or it is for the 1.1
(not-yet-existent) source tree? incze
Re: content map population
Posted by Cedric Dumoulin <ce...@lifl.fr>.
Not yet, but in a few days I will provide such facilities for
Templates. If you want to know how it will work, I have put an extract
of a previous mail at the end of this mail.
Cedric
Joe Mathews wrote:
> I am using template tag library for my project. All
> the template files in my project are dynamic.
> Is is possible to populate the content map in my
> java code and use it along with insert template
> Thanks
> Joe
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices.
> http://auctions.yahoo.com/
Extract from "Re: PROPOSAL: Template Screens"
...
I think that we can reuse actual Templates syntax, rather than
introducing too
much new tags or using scriptlet. This will simplify learning and
comprehension of
Templates.
Following is an example of how we could define a screen inside a jsp :
--------------
<template:screenDefinition id='introductionScreen' scope='request'
template='/chapterTemplate.jsp' >
<template:put name='title' content='Templates' direct='true'/>
<template:put name='header' content='/header.html' />
<template:put name='sidebar' content='/sidebar.jsp' />
<template:put name='content' content='/introduction.html'/>
<template:put name='footer' content='/footer.html' />
</template:screenDefinition>
---------------
To use it :
<template:insert definition='introductionScreen' />
---------------
Or, if you want to overload one attribute :
<template:insert template='/anotherchapterTemplate.jsp'
definition='introductionScreen' />
---------------
Or, if you want to overload or add others attributes :
<template:insert definition='introductionScreen' >
<put name='title' content='Another Title' />
<put name='leftSidebar' content='/leftsidebar.jsp' />
</template:insert>'
---------------
Some comments :
* In the "screenDefinition", you can define all or only some of the
attributes.
So, you can drop "template='/chapterTemplate.jsp' "
* If you specify some attributes in 'insert' tag, they overload
previously
defined attributes, or add new one.
* This syntax is implementation independent : object produced by tag
handler
'template:screenDefinition' could be a Map, or a complex structure.
* There is no 'role' attribute in the example, but we can use it.
* Advantage of this syntax is that it is the same than 'insert'. This
syntax can
also be used in a xml description file, without introducing new
concepts.
* Another advantage, is that there is no scriplet inside JSP page.
Now, we need to find a way to define 'screenDefinition' outside a JSP
page (ex: in
action).
A Map could be a candidate. But putting 'content', 'content-type'
(direct) and
'role' inside Map's value is not so easy to use.
We could thing of a class ScreenDefinition, having some method
reflecting the tag
syntax :
setTemplate( String templateName )
put( String name, Object content );
put( String name, Object content, boolean direct );
put( String name, Object content, boolean direct, String role );
...
Such class could be easiest to use in code. Once an instance is
created, it is
put in servlet context (request, session, ...).
Then, object is used in the same way as if it is define in the JSP page
:
<template:insert definition='screenDefinitionName' />
However, it is possible to implement <insert definition="aDefinition" />
in order
to accept a Map as well as a ScreenDefinition, if we want to keep both
possibilities.
Last, I thing that tag name 'template:screenDefinition' is too
restrictive : we
could effectively define a screen , but we can do much more with it,
like defining
a 'Component' ;-) . So maybe we need to propose something else for this
tag name
(first ideas : 'template:definition', or 'template:instance' ).
Cedric
...