Sun Java System Web Server 7.0 NSAPI Developer's Guide

Defining Custom Server-parsed HTML Tags

HTML files can contain tags that are executed on the server. For general information about server-parsed HTML tags, see the Sun Java System Web Server 7.0 Developer’s Guide.

In Web Server 7.0, you can define your own server-side tags. For example, you could define the tag HELLO to invoke a function that prints Hello World!You could have the following code in your hello.shtml file:


<html>
    <head>
            <title>shtml custom tag example</title>
    </head>
    <body>
            <!--#HELLO-->
    </body>
</html>

      

When the browser displays this code, each occurrence of the HELLO tag calls the function.

The steps for defining a customized server-parsed tag are listed below, and described in this chapter.

ProcedureTo Define Customer Server-parsed HTML Tags

  1. Define the Functions that Implement the Tag.

    You must define the tag execution function. You must also define other functions that are called on tag loading and unloading, and on page loading and unloading.

  2. Write an Initialization Function.

    Write an initialization function that registers the tag using the shtml_add_tag function.

  3. Load the New Tag into the Server.