daytag: a Taglib for Web Development with Daylight
Ragu Bharadwaj,
Daylight CIS Inc.
daytag is a tag library for accessing Daylight functionality in JSPs.
In this talk I shall
- describe the motivation for development of daytags
- describe JSPs and taglibs
- describe the daytag taglib
- show a few examples using taglib
- show an example of a vcs access web application developed using
daytags & dbtags
Web applications do 2 things
- compute e.g. access a db, compute a value,...
- output the results in HTML
Web apps were written via 2 models:
- A computer program that does both things (e.g .access a database,
& parse and present the output in HTML). The programs often have
HTML output statements interspersed in their logic. Such programs
are a pain to maintain & alter because of the mixing of content &
display.
- A HTML web page with scriptlets written in Java/PHP or some other
language, interspersed in the HTML code. Logic is in the scriptlets.
Display is in the HTML.
Both models suffer from the problem that because display & logic are
interspersed, maintenance & changes are difficult. To alleviate
the problem:
- some web app development models resort to XML/XSLT solutions
where data is always passed as XML and formatting to HTML is done via
XSLT. The pros & cons here are
- Pro: XML is easy to parse. So code can be reused in non-web
based development too.
- Con: XSLT is not easy to program.
- other models program functionality to be invoked from HTML in tags.
e.g. in such a model one might conceivably invoke the Daylight
canonicalization function via the HTML
<HTML>
<BODY>
The canonical SMILES for c1ccccc1C(=O)Cl is:
<CANSMI>c1ccccc1C(=O)Cl</CANSMI>
</BODY>
</HTML>
While the resultant HTML does have non-HTML tags, these tags are
function calls and thereby smaller than scriptlets.
Taglibs (short for tag libraries) introduce custom tags
within a JSP(Java Server Page) engine such as
Tomcat. A JSP engine such as
Tomcat can plug into a web server such as Apache, Netscape or IIS, or can
function independently as a web server itself.
daytag is a taglib for accessing Daylight functionality from
within Daylight. The daytag documentation can be accessed
here.
Some examples using daytags are available
here
One of the advantages of using taglibs is the availability of
free taglibs at the
Jakarta website.
For example the
DBTags
taglib provides a great way to access
Oracle and Daycart via standard SQL from JSPs. Query results
are easily parsed via available tags.
A web application to access the VCS database
being developed by John Bradshaw has been created using the
daytag and DBTags. Due to taglib usage, it took us about a
a week to develop the app. (Most of the time was spent figuring SQL)
Last modified: Sun Feb 24 21:59:04 MST 2002