Just as much as a free, and standardized API has accelerated Java
adoption, a free and standardized tag library will accelerate JSP
adoption. If enough developers can agree on a set of tags that solve
common problems, then there is a strong argument to make those tags open
source and include them into the <jsp: > namespace. The rest of this
posting is a preliminary proposal for the following tags to be
standardized:
Tags which encapsulate implicit JSP objects:
1) <setPageData> and <getPageData>: get/set methods for declaring and
referencing page scope scripting variables. This essentially converts
the output of any custom tag which normally out.print()'s into a page
scope scripting variable.
eg)
<setPageData name="foo" type="java.lang.String">
<myCustomTag/>
</setPageData>
<jsp:forward page="<%=foo%>"/>
Note that <jsp:forward page="<myCustomTag/>"/> is illegal in JSP and
XML, and that attributes passed to a custom tag are not always
constants. The <%= %> is the only variable resolution mechanism that
can be embedded in a tag attribute, so a custom tag that converts the
output of custom tags into a resolvable page scope variable is
necessary.
2) <setSessionData> and <getSessionData>: get/set methods for declaring
and referencing session scope variables. Obvious uses include "Show
next 10 records" and "Shopping Cart" functionality.
3) <setRequestData>, <getRequestData>, <setApplicationData>,
<getApplicationData>: get/set methods for declaring and referencing
variables for request and application scope respectively. Not as
critical as the previous two set of tags, but necessary for symmetry and
completeness' sake.
As for the other implicit objects, (response, pageContext, out, config,
exception), I am not convinced as to their usefulness from an HTML
authoring point of view. Their functionality is important for back-end
business logic and should probably be encapsulated by Beans instead of
tags (the old argument for the separation of display and business logic
in web apps).
Tags which encapsulate database functionality:
1) <connection>: allows for connection pooling, and multiple queries to
reuse a common database connection.
2) <query>: allows for execution of arbitrary SQL statements over a
<connection>. Some may agrue that this tag should be <sql> as <query>
implies SELECT functionality only. ADD, UPDATE, DELETE, etc SQL
functionality seems problamatic to encapsulate in a custom tag; an open
discussion to solve this common problem would be much appreciated (ie:
How do you implement rollbacks?)
3) <loop>: iteration over a <query>; FOR EACH functionality
4) <field>: outputs the contents of a database field. Probably only
makes sense being nested within a <loop> tag.
Feel free to comment on any of these proposed tags, or to propose tags
of your own. Especially needed is an attribute list and nesting
restrictions for these tags so a Document Type Descriptor can be spec'd
out and implemented.
--
Michael Hu, Paradox Team, Corel Corporation
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html