Sun ONE logo      Previous      Contents      Index      Next     

Sun ONE Web Server 6.1 Getting Started Guide

Chapter 6
Running Java Web Applications On Your Server

Sun ONE Web Server 6.1 allows you to create and deploy web applications that extend your server dynamically. Sun ONE Web Server 6.1 provides a runtime environment, the web container, that supports web applications. The web container supports the Java™ Servlet 2.3 API specification and the JavaServer Pages™ (JSP™) 1.2 specification, which allow servlets and JSPs to be included in web applications.

A web application is a collection of servlets, JSPs, HTML documents, and other web resources which might include image files, compressed archives, and other data.

To deploy a web application using the web-based Sun ONE Web Server interface you need to specify where the web archive (WAR) file for the application is located.

In this chapter, we will use a sample application that’s bundled with Sun ONE Web Server to walk through the steps involved in deployment. For details on how to create a web application and write servlets and JSPs, refer to the Sun ONE Web Server 6.1 Programmer’s Guide to Web Applications.

Located in the server_root/plugins/java/samples/webapps/simple directory is a WAR file, webapps-simple.war, for a simple web application.

To deploy this application:

  1. Access the virtual server and click the Web Applications tab

  2. Figure showing the Deploy Web Applications page.

  3. Because the WAR file resides on the server, select Server Machine from the “WAR File On” drop-down list and click the Go button.
  4. Specify the following:
    • The absolute path to the sample WAR file, webapps-simple.war:
    • <install_root>/plugins/java/samples/webapps/simple/webapps-simple.war

    • The application URI:
    • /simple.

      You needn’t make any changes to the default installation directory

  5. Click OK and then Apply to save and apply your changes.
  6. To launch the application, type the following URL in a browser window:
  7. http://server-name:port/simple

Figure showing the webapps-simple sample application deployed on the server.

The web application contains a listing of several sample web applications that you can run. Traverse the JSP and servlet links to execute each sample web application, as shown below:

Figure showing the contents of the servlet listing on the webapps-simple web application.

The page server_root/plugins/java/samples/index.html is a good place to begin exploring and running the sample applications that are bundled with Sun ONE Web Server. In the following chapter, "Setting Up Database Connectivity," we will use of these sample applications, the jdbc-simple sample, to demonstrate how you can set up database connectivity and use Java resources in web applications.

Previous      Contents      Index      Next     

Copyright 2004 Sun Microsystems, Inc. All rights reserved.