Java provides an alternative approach to Perl for enabling web communication with an Oracle database. In this section, we’ll provide a rough outline of using Java for web applications. Refer to Chapter 7 and Chapter 8 for much more detail about Java and its use with Oracle.
Java has its own version of an
HTML language, aptly called JavaServer Pages (JSP), and its
.jsp pages are analogous to
.asp Active Server Pages. Using JSP, you add
code to an HTML template page, rather than write a script that
generates an HTML page, as is the case with Perl. The Java approach
is similar to that of other embedded scripting languages such as PHP,
which we’ll describe later in this chapter. In addition to
accessing pure Java, a web page can also access precompiled Java
Beans, which facilitates component-based code and interoperability
and allows you to encapsulate functionality outside the page.
JavaServer Pages, like the various embedded scripting technologies discussed later in the chapter, allow you to embed code in your HTML pages. The code is preprocessed, and a complete HTML page is then returned by the web server.
Java servlets are bits of code which run on the server machine and are invoked by the web server. Java servlets are an alternative to JSPs. They operate in much the same way that other CGI programs do. But to make Java servlets work, you need a special module—namely, JServ for Apache, ...