bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

Programming WebLogic JSP

JSP Overview

This document is an introduction and reference for the basic syntax of JavaServer Pages (JSP). It provides information about how to use JSP with WebLogic Server. It is not intended as a comprehensive guide to programming with JSP.

The following sections provide an overview of JSP:

- What Is JSP?

- WebLogic Implementation of JSP

- How JSP Requests Are Handled

- Additional Information

What Is JSP?

JavaServer Pages (JSP) is a Sun Microsystems specification for combining Java with HTML to provide dynamic content for Web pages. When you create dynamic content, JSPs are more convenient to write than HTTP servlets because they allow you to embed Java code directly into your HTML pages, in contrast with HTTP servlets, in which you embed HTML inside Java code. JSP is part of the Java 2 Enterprise Edition (J2EE).

JSP enables you to separate the dynamic content of a Web page from its presentation. It caters to two different types of developers: HTML developers, who are responsible for the graphical design of the page, and Java developers, who handle the development of software to create the dynamic content.

Because JSP is part of the J2EE standard, you can deploy JSPs on a variety of platforms, including WebLogic Server. In addition, third-party vendors and application developers can provide JavaBean components and define custom JSP tags that can be referenced from a JSP page to provide dynamic content.

WebLogic Implementation of JSP

BEA WebLogic JSP supports the JSP 1.2 specification from Sun Microsystems. JSP 1.2 includes support for defining custom JSP tag extensions. (See Programming JSP Extensions)

The WebLogic Server implementation of the JSP 1.3 specification calls getOutputStream rather that getWriter to output characters in a JSP. This can cause certain extended characters to be truncated and to appear incorrectly. Using HTML code for extended characters such as the Angsrtom unit and the degree symbol will ensure that they will be processed correctly by your WebLogic Server instance.

IWebLogic Server also supports the Servlet 2.3 specification from Sun Microsystems.

How JSP Requests Are Handled

WebLogic Server handles JSP requests in the following sequence:

1. A browser requests a page with a .jsp file extension from WebLogic Server.

2. WebLogic Server reads the request.

3. Using the JSP compiler, WebLogic Server converts the JSP into a servlet class that implements the javax.servlet.jsp.JspPage interface. The JSP file is compiled only when the page is first requested, or when the JSP file has been changed. Otherwise, the previously compiled JSP servlet class is re-used, making subsequent responses much quicker.

4. The generated JspPage servlet class is invoked to handle the browser request.

It is also possible to invoke the JSP compiler directly without making a request from a browser. For details, see Using the WebLogic JSP Compiler. Because the JSP compiler creates a Java servlet as its first step, you can look at the Java files it produces, or even register the generated JspPage servlet class as an HTTP servlet.

Additional Information

- JavaServer Pages Tutorial from Sun Microsystems

- JSP product overview from Sun Microsystems

- JSP 1.1 Specification from Sun Microsystems

- Programming JSP Extensions

- Programming WebLogic HTTP Servlets

- Assembling and Configuring Web Applications