tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <cmcclana...@mytownnet.com>
Subject Re: [PROPOSAL] <Servlet> tag
Date Sat, 12 Feb 2000 11:46:05 GMT
"Daniel L. Rall" wrote:

> > > If we are going to supply *the* servlet engine, it would be helpful to
> > > support common extensions offered by other broadly used products, thus
> > > facilitating the switch to Apache Tomcat by having these common
> > > extensions available.
>
> > Tomcat does not want to be the one and only servlet engine, much as
> > apache (to my knowledge) does not want to be the one and only http
> > server.
>
> I'd like Tomcat to be the best servlet engine (not the only), if I am to
> be using it on my projects.  (Just as I consider Apache to be the best
> web server.)  My definition of best in this context is high--but not
> necessarily highest--performace, powerful, configurable, extendable, and
> feature rich.
>
> > The tomcat core is facing a serious limitation in the regard of
> > what you want it to do by adding defacto standards to tomcat.
>
> I don't understand this.  Could you expound upon it a bit?  Does this
> have to do with the <PREFIX:TAG> syntax that Hans indicated must be
> used?
>

JSP page compilers have to parse the input page to identify custom tags, as
well as the standard tags.  In all cases (starting with JSP 1.0 at least),
the JSP tags being recognized have a prefix -- "jsp:" for the standard
actions, and whatever prefix you describe for custom tag libraries.  No other
tags will be parsed -- it is assumed that they are to be sent to the client
making the request.

Thus, implementing <servlet> as a custom tag is not going to achieve your
primary goal -- allow porting of an application based on this to run on
Tomcat, because the syntax would have to change anyway.  If that's the case,
it's just as easy to change it to <jsp:include>, which you can use without
knowing a thing about the other JSP-related stuff like beans.

But see below for a different alternative.

>
> > Tomcat is
> > a reference implementation of a published standard, servlet 2.2 and JSP
> > 1.1.  Support for defacto standards are a possibility but unfortunately
> > most of these would force tomcat to violate the spec.
>
> Such as adding a tag with no prefix?  (I'm not actively trying to beat
> this subject to death, even though it kinda looks that way.  ;)
>

Tags with no prefix are sent to the client.  That's the way it will work in
all standard implementations, so there's no point in trying to change it just
for Tomcat.

However, you can implement <servlet> tags yourself, in a servlet, if you
don't also want that page to support JSP.  The basic technique would go like
this:

* Create a servlet that does the page parsing, and
  implements the functionality of the servlet tag as
  well as is possible.  This is more work than it sounds
  like -- you'd probably be better off starting from an
  existing implementation like Apache JSSI and modifying
  it to work under Tomcat <http://java.apache.org>.

* Register this servlet in the deployment descriptor of
  your web application.

* Also in the deployment descriptor, add a <servlet-mapping>
  element that maps the "*.shtml" extension to your servlet.

I wouldn't have any objection to someone contributing such a servlet to the
Tomcat code base as an add-on feature, or adding it as a default so you don't
have to explicitly map it.  But, in the big picture, applications that depend
on this should really be migrated to use <jsp:include>, or converted to some
other template system's mechanism.  The <servlet> tag was never (and I'd bet
never will be) an official standard -- it was only a defacto one -- and it's
functionality is limited compared to the current alternatives.

Craig McClanahan



Mime
View raw message