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

Introducing Web Applications

Sun Java System Web Server 6.1 supports the Java™ Servlet 2.3 API specification and the JavaServer Pages (JSP) 1.2 specification, which allows servlets and JSPs to be included in web applications.

A web application is a collection of servlets, JavaServer Pages, HTML documents, and other web resources that might include image files, compressed archives, and other data. A web application can be packaged into a Web ARchive file (a WAR file) or exist in an open directory structure.

In addition, Sun Java System Web Server 6.1 supports SHTML and CGI, which are non-Java™ 2 Platform, Standard Edition (J2SE platform) application components.

This section includes summaries of the following topics:


Java servlets are server-side Java programs that application servers can run to generate content in response to a client request. Servlets can be thought of as applets that run on the server side without a user interface. Servlets are invoked through URL invocation or by other servlets.

Sun Java System Web Server 6.1 supports the Java Servlet 2.3 specification.

Note –

Java Servlet API version 2.3 is fully compatible with versions 2.1 and 2.2, so all existing servlets will continue to work without modification or recompilation.

To develop servlets, use Sun's Java Servlet API. For information about using the Java Servlet API, see the documentation provided by Sun at:

For the Java Servlet 2.3 specification, please visit:

For information about developing servlets in Sun Java System Web Server, see Chapter 3, Using Servlets.


Sun Java System Web Server 6.1 supports the JSP 1.2 specification.

A JSP is a page, much like an HTML page, that can be viewed in a web browser. However, in addition to HTML tags, it can include a set of JSP tags and directives intermixed with Java code that extend the ability of the web page designer to incorporate dynamic content in a page. These additional features provide functionality such as displaying property values and using simple conditionals.

One of the main benefits of JSPs is that they are like HTML pages. The web page designer simply writes a page that uses HTML and JSP tags and puts it on his or her web server. The page is compiled automatically when it is deployed. The web page designer needs to know little about Java classes and Java compilers. Sun Java System Web Server supports precompilation of JSPs, however, and this is recommended for production servers.

JSP pages can access full Java functionality by:

Servlets are Java classes that must be compiled, but they can be defined and compiled by a Java programmer, who then publishes the interface to the servlet. The web page designer can access a precompiled servlet from a JSP page.

Sun Java System Web Server 6.1 supports JSP tag libraries and standard portable tags.

For information about creating JSPs, see Sun's JavaServer Pages web site at:

For information about developing JSPs in Sun Java System Web Server, see Chapter 4, Using JavaServer Pages.


HTML files can contain tags that are executed on the server. In addition to supporting the standard server-side tags, or SSIs, Sun Java System Web Server 6.1 allows you to embed servlets and define your own server-side tags. For more information, see the Sun Java System Web Server 6.1 SP6 Programmer’s Guide.


Common Gateway Interface (CGI) programs run on the server and generate a response to return to the requesting client. CGI programs can be written in various languages, including C, C++, Java, Perl, and as shell scripts. CGI programs are invoked through URL invocation. Sun Java System Web Server complies with the version 1.1 CGI specification. For more information, see the Sun Java System Web Server 6.1 SP6 Programmer’s Guide.