You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by John Nikolai <jn...@azika.com> on 2001/02/21 01:31:02 UTC

Template tags?

	
Hi all!

I'm defiantly new to the struts and taglibs so please bear with my questions:

We are writing a proof of concept to see if struts will meet our needs for 
a non-profit customer we are working with. Several questions have come up 
during this process. First off,  the web pages we will be creating will 
have a common navigation bar used across the whole web site. It would be 
great if we can create one HTML file called navigation.jsp which all pages 
use. It seems that the struts template taglibs might be the solution, 
unfortunately the 0.5 version of struts we downloaded does not contain 
these taglibs. The template taglibs are in CVS and easily accessed but I'm 
wondering if these are going to be distributed in the next release of 
struts. Also I'm wondering if the template taglibs will suit our needs. Any 
other solutions to the above problem would be greatly appreciated.

OK, this was only one question. I'm sure as we move along with the proof of 
concept more will pop up.

Thanks for all your help,
  - John


RE: Template tags?

Posted by John Nikolai <jn...@azika.com>.
At 08:27 PM 2/20/2001 -0500, you wrote:
> > during this process. First off,  the web pages we will be creating will
> > have a common navigation bar used across the whole web site. It would be
> > great if we can create one HTML file called navigation.jsp which
> > all pages use.
>
>If that's the only common element on the pages, you can do that
>using the JSP include tags, pulling in the common nav bar within
>each content page.
>
>The template tags (as we've been using them, at least) support a
>somewhat different model: your content pages push their specific
>content into common templates, which place the content into regions
>of the template.  This allows you to have standard headers, footers,
>or any other common content and layout without the content pages
>needing to know or care what the standard layout is; it also allows
>you to redesign the template, potentially completely re-ordering
>the content presentation, without changing the content pages at all.
>
>We've introduced the template tags to both java coders and HTML
>authors, and all found it easy to understand and like,
>and quite powerful.

This is what we used to do with our old custom tags. We would have one html 
file which contained the navigation portion (both a top and left hand 
navigation bar). We inserted a custom tag called "application" which would 
be "filled" in with a particular application when rendered. We wrote one 
class to render the navigation portion and created several abstract methods 
so that subclass can fill in the "application" and "menu" tags as needed. 
It looked like the following (please excuse the bad ascii art ;-)

  NavPageDisplayer
         ^
         |-------- ProfilePageDisplayer
         |-------- LoginPageDisplayer
         |-------- MainPageDisplayer
         |-------- etc...

So each NavPageDisplayer subclass would always be rendered with the 
navigation bar. With this design it was very easy to create a new dynamic 
page. I was hoping we could do something similar with the template taglib 
used by struts.


> > It seems that the struts template taglibs might be the solution,
> > unfortunately the 0.5 version of struts we downloaded does not contain
> > these taglibs.
>
>In my experience, cvs or nightly builds have been solid for
>a long while, and have been quite safe for development, not
>only for the template tags, but for the entire library.
>
>Andy Boyko    aboyko@fabgear.com


I will download the latest source from cvs. Thank you to everyone for your 
help!

  - John


Re: Template tags?

Posted by David Geary <sa...@tri-lakesonline.net>.
John Nikolai wrote:

> We are writing a proof of concept to see if struts will meet our needs for
> a non-profit customer we are working with. Several questions have come up
> during this process. First off,  the web pages we will be creating will
> have a common navigation bar used across the whole web site. It would be
> great if we can create one HTML file called navigation.jsp which all pages
> use. It seems that the struts template taglibs might be the solution,
> unfortunately the 0.5 version of struts we downloaded does not contain
> these taglibs. The template taglibs are in CVS and easily accessed but I'm
> wondering if these are going to be distributed in the next release of
> struts. Also I'm wondering if the template taglibs will suit our needs. Any
> other solutions to the above problem would be greatly appreciated.

Yes, it sounds like templates suit your needs. And templates will be in
future Struts releases.


david  (developer of the Struts template tags)


Re: Template tags?

Posted by David Geary <sa...@tri-lakesonline.net>.
Andrew Boyko wrote:

> > during this process. First off,  the web pages we will be creating will
> > have a common navigation bar used across the whole web site. It would be
> > great if we can create one HTML file called navigation.jsp which
> > all pages use.
>
> If that's the only common element on the pages, you can do that
> using the JSP include tags, pulling in the common nav bar within
> each content page.

True, but templates are so much cooler.  ;-)

> The template tags (as we've been using them, at least) support a
> somewhat different model: your content pages push their specific
> content into common templates, which place the content into regions
> of the template.  This allows you to have standard headers, footers,
> or any other common content and layout without the content pages
> needing to know or care what the standard layout is; it also allows
> you to redesign the template, potentially completely re-ordering
> the content presentation, without changing the content pages at all.

Another benefit is that templates encourage you to divide your JSP pages
into reusable components, although the same could be said of <jsp:include>.

> We've introduced the template tags to both java coders and HTML
> authors, and all found it easy to understand and like,
> and quite powerful.

Amen.

> > It seems that the struts template taglibs might be the solution,
> > unfortunately the 0.5 version of struts we downloaded does not contain
> > these taglibs.
>
> In my experience, cvs or nightly builds have been solid for
> a long while, and have been quite safe for development, not
> only for the template tags, but for the entire library.

Templates are in Struts to stay.


david



RE: Template tags?

Posted by Andrew Boyko <ab...@fabgear.com>.
> during this process. First off,  the web pages we will be creating will 
> have a common navigation bar used across the whole web site. It would be 
> great if we can create one HTML file called navigation.jsp which 
> all pages use.

If that's the only common element on the pages, you can do that 
using the JSP include tags, pulling in the common nav bar within
each content page.

The template tags (as we've been using them, at least) support a 
somewhat different model: your content pages push their specific 
content into common templates, which place the content into regions 
of the template.  This allows you to have standard headers, footers,
or any other common content and layout without the content pages 
needing to know or care what the standard layout is; it also allows 
you to redesign the template, potentially completely re-ordering 
the content presentation, without changing the content pages at all.

We've introduced the template tags to both java coders and HTML
authors, and all found it easy to understand and like,
and quite powerful.  

> It seems that the struts template taglibs might be the solution, 
> unfortunately the 0.5 version of struts we downloaded does not contain 
> these taglibs. 

In my experience, cvs or nightly builds have been solid for
a long while, and have been quite safe for development, not
only for the template tags, but for the entire library.  

Andy Boyko    aboyko@fabgear.com