struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rod Bollinger" <techi...@portablegenius.com>
Subject RE: [OT] Re: Struts tile and other tag includes
Date Sun, 12 Aug 2007 19:05:47 GMT

Perhaps you are referring to the use of scriptlets being discouraged (with
which I agree). However, <%@ include ... %> is a JSP "directive", not
scriptlet code and is in no way deprecated or discouraged.

The following excerpt is from the JSP 2.1 specification (the latest version
of JSP):

<blockquote>
JSP.1.10.3 The include Directive

	The include directive is used to substitute text and/or code at JSP
page translation-time. The <%@ include file="relativeURLspec" %> directive
inserts the text of the specified resource into the page or tag file. The
included file is subject to the access control available to the JSP
container. The file attribute is as in Section JSP.1.2.1. 
	With respect to the standard and XML syntaxes, a file included via
the include directive can use either the same syntax as the including page,
or a different syntax. the semantics for mixed syntax includes are described
in Section JSP.1.10.5.
	A JSP container can include a mechanism for being notified if an
included file changes, so the container can recompile the JSP page. However,
the JSP 2.1 specification does not have a way of directing the JSP container
that included files have changed.
	The <jsp:directive.include> element (Section JSP.6.3.5, "The
jsp:directive.include Element") describes the same information following the
XML syntax.

Examples

The following example requests the inclusion, at translation time, of a
copyright file. The file may have elements which will be processed too.

<%@ include file="copyright.html" %>

Syntax

<%@ include file="relativeURLspec" %>
</blockquote>

The solution advised by Martin is indeed the proper way to address the issue
at hand and personally has been proven to be a very effective approach in
several large-scale, mission critical enterprise application projects where
Struts, Tiles, JSTL, and other custom tag libraries were in use. 

Adding a single include directive (instead of a dozen or more) to each of
several hundred JSPs is a much cleaner and more maintainable solution.

I highly recommend reading (or re-reading) the JSP 2.1 specification -
especially section JSP.1.10.5 (including data in JSP pages) for more
information.

Regards,
-Rod Bollinger


-----Original Message-----
From: Yayo [mailto:eduyayo@gmail.com] 
Sent: Sunday, August 12, 2007 14:23
To: Struts Users Mailing List
Subject: Re: [OT] Re: Struts tile and other tag includes

ld use the word "discouraged" ^g^

On 8/12/07, Yayo <eduyayo@gmail.com> wrote:
>
> yeah, I know, but we can use cobol to program cgi instead of java too
>
> On 8/12/07, Dave Newton <newton.dave@yahoo.com > wrote:
> >
> > Then how do you figure it's been deprecated? It's the
> > only thing that will allow doing what the original
> > post was talking about.
> >
> > --- Yayo <eduyayo@gmail.com> wrote:
> >
> > > I know!
> > >
> > > On 8/12/07, Dave Newton <newton.dave@yahoo.com >
> > > wrote:
> > > >
> > > > --- Yayo <eduyayo@gmail.com> wrote:
> > > > > think that's a bad solution, the <include> has
> > > been
> > > > > deprecated by the use of tiles and the like to
> > > > > compose pages... and even with that I don't
> > > think
> > > > > it will work...
> > > >
> > > > <%@ include ...%> is a directive; the file is
> > > inserted
> > > > at compile, not run, time.
> > > >
> > > > d.
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
____________________________________________________________________________
________Ready
> >
> > > > for the edge of your seat?
> > > > Check out tonight's top picks on Yahoo! TV.
> > > > http://tv.yahoo.com/
> > > >
> > > >
> > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > user-unsubscribe@struts.apache.org
> > > > For additional commands, e-mail:
> > > user-help@struts.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > "Nada fija tan intensamente una cosa a la memoria
> > > como el deseo de
> > > olvidarla." (Michel de Montaigne)
> > >
> > > http://yayocaturas.blogspot.com/
> > >
> >
> >
> >
> >
> >
> >
____________________________________________________________________________
________
> > Sick sense of humor? Visit Yahoo! TV's
> > Comedy with an Edge to see what's on, when.
> > http://tv.yahoo.com/collections/222
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
> --
> "Nada fija tan intensamente una cosa a la memoria como el deseo de
> olvidarla." (Michel de Montaigne)
>
> http://yayocaturas.blogspot.com/
>



-- 
"Nada fija tan intensamente una cosa a la memoria como el deseo de
olvidarla." (Michel de Montaigne)

http://yayocaturas.blogspot.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message