Incorporating Custom Tags

Before you get started with creating a custom tag library, it's important that you become familiar with its operation. Within a JSP, you can add custom tags—HTML-like tags but with a specific name and prefix. In our application, we will create custom tags such as the following:

<as:today/>
<as:error color="blue">The Month is invalid</as:error>
<as:loop n="5">
   <td><as:insertCount/></td>
</as:loop>
<as:email smtpHost="mail.auction.station.net">
   <as:from address="maneesh@auction.station.net">Maneesh Sahu</as:from>
   <as:to address="errors@auction.station.net">Error Reporter</as:to>
   <as:subject>Stop the press</as:subject>
   <as:body>An Error occurred </as:body>
</as:email>

The name of the custom tag has a prefix, in this ...

Get Java Server Pages from scratch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.