There are three classes of scripting elements: declarations, scriptlets and
expressions (JSP 2.0 adds a fourth: EL expressions):

<%! declaration %>
<%  scriptlet   %>
<%= expression  %>

<%@ taglib ... %> and <%@ tag ... %> are directives, which are quite distinct
from scriptlets. Just because you're using XML notation (JSP documents),
doesn't mean that scriptlets are implicitly disallowed:

<jsp:scriptlet>...</jsp:scriptlet>

With JSP 2.0, you can use <scripting-invalid> in web.xml to disable non-EL
scripting:

<jsp-config>
  <jsp-property-group>
    <url-pattern>*.jsp</url-pattern>
    <scripting-invalid>true</scripting-invalid>
  </jsp-property-group>
  ...
</jsp-config>

JSP 2.0 also provides the ability to define implicit includes (operates like the
include directive):

<jsp-config>
  <jsp-property-group>
    <url-pattern>*.jsp</url-pattern>
    <include-prelude>/WEB-INF/taglibs.jspf</include-prelude>
    <include-coda>/WEB-INF/footer.jspf</include-coda>
  </jsp-property-group>
  ...
</jsp-config>

Finally, AFAIK <jsp:directive.taglib> is not part of the JSP spec. It may have
been part of a draft for JSP 1.2 but I don't think it made the final cut
(someone correct me on that if I'm off-base). For JSP documents, xmlns
attributes are used to declare which taglibs are being used.

Quoting Steve Lewis <[EMAIL PROTECTED]>:

> Help -
> My jsp files all use the same set of about a half dozen tag declarations
> Rather than place them at the top of every page I start every page with the
> declaration
> <jsp:directive.include file="/include/b17StartJSP.inc" />
> b17StartTile.inc
> does some housekeeping and at some point includes /include/b17StartTile.inc 
> which does more housekeepiong and includes
> declareTags.inc which looks like this:
> <jsp:directive.taglib uri="http://java.sun.com/jstl/core"; prefix="c"  />
> ... more tags
> and some jsp taglibs
> <jsp:directive.taglib tagdir="/WEB-INF/tags/formpatterns" prefix="fm"  />
> 
> under resin there is no problem with this and under tomcat 5 I get
> 
> 
> org.apache.jasper.JasperException: /HelloStruts.jsp(1,1) 
> /include/b17StartJSP.inc(2,3) /include/b17StartTile.inc(1,4) 
> /include/declareTags.jsp(3,18) <jsp:directive.tag directive can only be 
> used in a tag file
> 
> 1) I never use the tag directive outside of custim tag files but I do use 
> jsp:directive.taglib
> 2) I would expect that included files would inherit the extension of the 
> including page (ultimately jsp)
> 3) I tried changing  include/declareTags.inc to include/declareTags.jsp (as 
> shown above) without success
> 4) I am reluctant to use <@ tag and <%@ taglib notation because I am trying 
> to ban scriptlets from ant page and use the curresponding XML notation
> 
> ANy ideas and suggestions -
> Because other containers support what I am doing I believe I am doing the 
> right thing
> 
> 
> 
> Steven M. Lewis PhD
> 4221 105th Ave NE
> Kirkland, WA 98033
> 425-889-2694
> 206-384-1340 (cell) 

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to