O'Reilly logo

Special Edition Using Java™ Server Pages and Servlets 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

Appendix A. JSP Syntax and API Reference

JSP Syntax

The basic JSP syntax is the same no matter what scripting language you are using. If you are familiar with Active Server Pages, the JSP syntax should look very familiar.

Code Scriptlets

The <% %> tags enclose any number of lines that are interpreted as executable code. Any code within the <% %> tags is placed in the main service method of the JSP.

Example:

<%
   for (int i=0; i < 10; i++)
   {
        out.println("Hello");
   }
%>

Expressions

The <%= %> tags enclose an expression whose value is inserted into the output stream.

Example:

Welcome back, <%= getFirstName() %>!

Declarations

The <%! %> tags enclose a series of declarations that are placed outside the main ...

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