Using the <% %> Tags in a Java Server Page

As you saw in the HelloWorld.jsp example, the <% and %> tags in a JSP file are used to indicate the presence of Java code within the HTML. The JSP specification allows for languages other than Java to be used for scripting. At the present time, few servers support languages other than Java; however, eventually there will be more support for other scripting languages. Until that time, and certainly for the rest of this book, the focus is on Java as the JSP scripting language.

Note

The Resin JSP engine from Caucho (http://www.caucho.com) has support for using JavaScript in a JSP instead of Java.

You can intermix the <% and %> tags with other HTML tags in just about any combination you can think of. The ...

Get Special Edition Using Java™ 2 Enterprise Edition 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.