Sun Java System Web Server 7.0 Developer's Guide to Java Web Applications

Technologies and Enhancements in Web Server 7.0

Sun Java System Web Server 7.0 is a major new release with significant enhancements in the administration infrastructure. This release is the first 64-bit version of Web Server supported on both the Solaris SPARC® and AMD64 platforms.

Web Server 7.0 provides:

This product also comes with a robust built-in migration tool that helps migrate applications and configurations from Web Server 6.0 and 6.1 to Sun Java System Web Server 7.0.

Sun Java System Web Server 7.0 introduces the following new features:

For more features and information, see What’s New in This Release? in Sun Java Enterprise System 2005Q4 Release Notes.

Supported Standards, Protocols, and Technologies

Servlet 2.4 Support

Java servlets are server-side Java programs that 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 7.0 supports the Java Servlet 2.4 specification.

Note –

Java Servlet API version 2.4 is fully backward compatible with versions 2.1, 2.2, and 2.3. Therefore, all existing servlets continues 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.4 specification, see

For information about developing servlets in Sun Java System Web Server, see Chapter 4, Developing Servlets

JSP 2.0 Support

Web Server 7.0 supports the JavaServer Pages (JSP) 2.0 specification. A JSP page is, much like an HTML page, that can be viewed in a web browser. However, in addition to HTML tags, JSP 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.

JSP pages can access full Java functionality using the following methods:

Servlets are Java classes that must be compiled. Servlets 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. For information about creating JSPages, see

JSTL 1.1

The Java Server Pages Standard Tag Library (JSTL) encapsulates as simple tags the core functionality common to many web applications. JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags. It also provides a framework for integrating existing custom tags with JSTL tags.

For more information on JSTL 1.1, see

Java Web Services Developer Pack 2.0 Support

Web Services uses a Web Services Description Language (WSDL) file to describe the service and a registry service to register and lookup the services. The Simple Object Access Protocol (SOAP) binding is the standard interoperable binding for accessing Web Services. Based on Java Web Services Developer Pack (Java WSDP), Sun Java System Web Server 7.0 supports integrated Java Web Services runtime and tools, and therefore supports portable Web Services implementations. For more information, see Chapter 3, Web Services Overview.

JNDI Naming

Web Server 7.0 provides Java Naming and Directory InterfaceTM (JNDI) API support that enables web applications to look up for Java Enterprise Edition (Java EE) services such as Java DataBase Connectivity (JDBCTM) data sources. All functional aspects of this JNDI implementation are essential. However, the web server's implementation does not support the CosNaming service required for remote objects as well as lookup of UserTransaction, ORB, JMS resources, or the EJB references.

JDBC Connection Pooling

In Sun Java System Web Server 7.0, JDBCRESOURCE and JDBCCONNECTIONPOOL elements in server.xml have been merged into one element called jdbc-resource to simplify JDBC configuration. Many of the configuration parameters have been renamed. For more information on the jdbc-resource element, see Chapter 3, Elements in server.xml, in Sun Java System Web Server 7.0 Administrator’s Configuration File Reference.

Using JNDI to Access the jdbc-resource Within a Web Application

Using JNDI, a web application can access a JDBC connection pool by looking up the jdbc-resource that configures it. The jdbc-resources can access the name in its web descriptor. The following web descriptors example refer to the connection pool created in the earlier example.


    <description>JDBC Connection Pool</description>



In the above example, jdbc/myJdbc is the name by which the pool is referenced in the web application and jdbc/MyPool is the JNDI name of the jdbc-resources configuration.

The following is an example for using the pool in a web application.

Context initContext = new InitialContext();
Context webContext = (Context)initContext.lookup("java:/comp/env");

DataSource ds = (DataSource) webContext.lookup("jdbc/myJdbc");
Connection dbCon = ds.getConnection();

Tools Support

Web Server 7.0 provides support for the following tools:

Lifecycle Listeners and Modules

Sun Java System Web Server 7.0 enables you to write customized classes for the various phases of the server lifecycle. For instance, a user may have a startup code that ensures that a remote data source is available for the applications. Such classes are notified of server lifecycle events supporting Java based tasks within the Web Server environment. These tasks automatically perform actions such as starting the server and sending notification if the server shuts down. You can use this support to instantiate singletons, RMI servers, and so forth. For more information, see List of Elements in Sun Java System Web Server 7.0 Administrator’s Configuration File Reference

Session Replication

The intention of session replication is to provide sufficient session failover support through in-memory-backup of HTTP sessions to another server instance of the same cluster. This feature covers most usage scenarios. For more information, see Configuring Session Replication in Sun Java System Web Server 7.0 Administrator’s Guide