Web Server supports the <servlet> tag. This tag allows you to embed servlet output in an SHTML file. No configuration changes are necessary to enable this behavior. If SSI and servlets are both enabled, the <servlet> tag is enabled.
The <servlet> tag syntax is slightly different from that of other SSI commands in that it resembles the <APPLET> tag syntax:
<servlet name= name code= code codebase= path iParam1= v1 iParam2= v2> <param name= param1 value= v3> <param name= param2 value= v4> . . </servlet> |
If the servlet is part of a web application, the code parameter is required and other parameters are ignored. The code parameter must include:
The value of the url-pattern element defined in the web.xml file for the web application. For more information about web.xml, see the Java Servlet 2.4 specification (chapter SRV .13, “Deployment Descriptor”). You can find the specification at: http://java.sun.com/products/servlet/download.html
The value of the uri attribute defined in the web-apps.xml file for the web application.
For example, if you want to include the following in your SHTML file:
<servlet name=pparams code="/PrintApp/PrintParams"> </servlet>
you need to include the following in your web-apps.xml file:
<web-app uri="/PrintApp" dir="/iws60/https-server.iplanet.com/acme.com/webapps/PrintApp"/>
you also need to include the following in your web.xml file:
<servlet> <servlet-name> pparams </servlet-name> <servlet-class> PrintPackage.PrintParams </servlet-class> </servlet> <servlet-mapping> <servlet-name> pparams </servlet-name> <url-pattern> /PrintParams </url-pattern> </servlet-mapping>
You must also include any servlet initialization parameters in the web.xml file.
For legacy servlets, the code parameter specifies the .class file for the servlet and is required. The codebase parameter is required if the servlet is not defined in the servlets.properties file and the .class file is not in the same directory as the HTML file containing the <servlet> tag. Legacy servlets must be configured in the default virtual server and do not require a web.xml file.
For more information about creating servlets, see the Creating Servlets in Sun Java System Web Server 7.0 Developer’s Guide to Java Web Applications.