Using Java with Oracle Web Applications

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 embedded HTML language, aptly called JavaServer Pages (JSP), and its .jsp pages are analogous to Microsoft’s .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 and Java Servlets

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, ...

Get Oracle and Open Source now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.