tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kin-Man Chung <Kin-Man.Ch...@Eng.Sun.COM>
Subject [Jasper2] framework for tag optimization
Date Sat, 23 Nov 2002 00:57:41 GMT
I am designing a framework in Jasper for enabling plugins that
work closely with Jasper to generate Java codes instead of calls
to tag handlers.  The main idea is to take take JSTL tags, such as

        <c:forEach var="i" begin="1", end="100">
            ${i}
        </c:forEach>

and generates the Java codes

        for (int i = 0; i <= 100; i++) {
            pageContext.setAttribute("i", String.valueOf(i));
            out.print(evaluate("${i}"));
        }

or even

        for (int i = 0; i <= 100; i++) {
            out.print(i);
        }

The design is not to do the actual optimization in Jasper, but to
provide a framework for taglib writers to develop plugins to Jasper
that will do the actual optimization.  Eventually, Jasper will be
bundled with 1 or 2 plugins for JSTL, as test cases for the framework
and as examples for writing the plugins.

The plugins are specified in a xml file:

	<tag-plugins>
	    <tag-plugin>
	        <tag-class>the name of the tag class</tag-class>
	        <plugin-class>the name of the pkugin class</plugin-class>
	    </tag-plugin>
	<tag-plugins>
	
There are currently 3 interfaces:

TagPluginFactory
   Used for creating a TagPlugin.
   
TagPlugin
   Created at code generation time for a specific tag invokation.  Used
   by Jasper to generate java codes.
   
TagPlugContext
   Created by Japser and used by the plugin to query properties of
   the current tag, and to use resources in Jasper.
   
This work is at the very early stage of the design, and is purely
experimental.  I'll be checking in sources for this work, and they
should not affect the other part of Jasper, when plugins are not
turned on.

I welcome comments and suggestions.


--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message