One of the most exciting features about JSP is the ability tobuild and use custom "tag libraries" in your JSP applications. In thisarticle, find out why tag libraries are a Good Thing, and read about how toget and install custom tag libraries for common tasks.
Now, our original thesis was that tag libraries would allow Web designers with no knowledge of JSP to implement complex functionality on a Web page. While the examples you've just seen were simple and illustrative, they haven't really proved that thesis - after all, it's reasonable to suppose that any competent Web designer would know how to manipulate date and time values via JavaScript and wouldn't really require a tag library for the purpose. So let's try something most client-side specialists wouldn't know how to handle - email delivery.
Typically, the process of generating email from a Web site is handled via a server-side script - Perl gurus open a pipe to sendmail, while PHP programmers reach for the mail() function. This implies a foreknowledge of either PHP or Perl - not something a novice Web designer may be expected to possess. What solution does JSP offer this poor soul?
The Jakarta MAILER library.
Using a couple of simple tags from this library, any Web developer can quickly add mail-processing capability to a Web page - in fact, the process is simpler than the equivalent techniques in Perl and PHP. Take a look.
<html>
<head>
</head>
<body>
<%@ taglib uri="jspmailer" prefix="jmail" %>
<jmail:mail server="mail.server.com" to="recipient@server.com"
from="sender@server.com" subject="This stuff is pretty cool!">
<jmail:message>
OK, you've convinced me - this tag library thing is awesome! Where do I
sign up?
</jmail:message>
<jmail:send/>
</jmail:mail>
</body>
</html>
By simplifying otherwise complex code, custom tag libraries
like the one above can promote both efficiency and harmony in group development projects, by allowing the developers to concentrate on building better tools (libraries) and the designers to concentrate on presentation (rather than code). As JSP evolves, you can expect tag libraries to grow in importance - even now, they are by far one of the most compelling reasons to choose this server-side language over others.