Sun Java System Web Server 6.1 SP6 Programmer's Guide to Web Applications

JSP by Extension

In Sun Java System Web Server 6.1, JSP by extension works as it did in previous releases. Any file in the document tree that is named as an extension of .jsp will be treated as a JSP as long as the Java is turned on for the virtual server.

Servlet by Extension of Servlet by Directory

This is not supported in Sun Java System Web Server 6.1. You can deploy a web application to respond to a directory, but all of the servlets must be in the WEB-INF/classes directory of the web application. You can no longer copy a servlet in the .class file into the document tree and have it run as a servlet or have all of the contents of a directory run as a servlet. The web application will treat only .class files as servlets.

Registered Servlets

In the legacy servlet system there was a two-step process of registering servlets ( and mapping them to a URL ( In Sun Java System Web Server 6.1, the servlets must be moved into a web application, and these settings will be maintained in the web.xml file of that web application.


A registered servlet contains entries in both the and files.

The following example uses a servlet file called BuyNow1A.class, which respons to /buynow. It is assumed that the web application is deployed at '/'.

The file has:

servlet.BuyNowServlet.initArgs=arg1=45,arg2=online,arg3="quick shopping"

The file has:


Those must be translated to a web.xml setting.

The setting will translate into the <servlet> element.

The classpath is automated so there is no classpath setting. All classes to be used must be in the WEB-INF/classes directory or in a .jar file in the WEB-INF/lib directory of the web application.

The servlet-name element is the part between the dots in the file. The code translates to the servlet-class. IntArgs translate to init-params. This entry would translate to:

    <servlet-name> BuyNowServlet </servlet-name>
    <servlet-class> BuyNow1A </servlet-class>
          <param-name> arg1 </param-name>
          <param-value> 45 </param-value>
          <param-name> arg2 </param-name>
          <param-value> online </param-value>
          <param-name> arg3 </param-name>
          <param-value> “quick shopping” </param-value>

The entries translate to servlet-mapping elements. This entry would translate to.

    <servlet-name> BuyNowServlet </servlet-name>
    <url-pattern> /buynow </url-pattern>

Some other entries in the file map to the web.xml file. These include.