O'Reilly logo

Sams Teach Yourself J2EE™ in 21 Days by Peter Roxburgh, Andy Longshaw, Debbie Law, Dan Haywood, Martin Bond

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

JSP Syntax and Structure

Before writing your first JSP, you need to gain an understanding of the syntax and the structure of a JSP.

As you have seen, JSP elements are embedded in static HTML. Like HTML, all JSP elements are enclosed in open and close angle brackets (< >). Unlike HTML, but like XML, all JSP elements are case sensitive.

JSP elements are distinguished from HTML tags by beginning with either <% or <jsp:. JSPs follow XML syntax, they all have a start tag (which includes the element name) and a matching end tag. Like XML tags, a JSP tag with an empty body can combine the start and end tags into a single tag. The following is an empty body tag:

<jsp:useBean id="agency" class="web.AgencyBean">
</jsp:useBean>

The following tag is equivalent ...

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