O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A "Hello World" Java Server Page

Java Server Pages are, in the most basic sense, Web pages with embedded Java code. The embedded Java code is executed on the server before the page is returned to the browser. If a picture is worth a thousand words, in this case an example is worth a thousand explanations. Listing 14.1 shows a basic Java Server Page.

Code Listing 14.1. HelloWorld.jsp
<HTML>
<BODY>
<%
    out.println("<H1>Hello World!</H1>");
%>
</BODY>
</HTML>

Although you can probably guess what the browser will display when this page runs, Figure 14.1 shows the output from this page.

Figure 14.1. A Java Server Page can generate HTML output.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required