Appendix A. JSP Syntax Reference

This book has covered a lot of ground. Every fundamental concept in JSP was discussed, and the example code presented important programming techniques. However, in order to maintain a reasonable flow in the text, the syntactical details of many JSP elements were not fully explored.

This appendix captures, at one location, all of the JSP elements that are covered in the text, and provides a more detailed syntax description. It should serve as a useful reference resource during your daily JSP programming activities.

JSP pages are text files composed of the following components:

  • Template text: Template text is any text that is not a JSP element. Template text is static and does not change between invocations of the same JSP.

  • JSP elements: Many JSP elements result in the dynamic generation of Web content. Because template text can be any static text, a JSP element can contain template text that is in any format. Two of the most common formats are HTML and XML.

JSP elements can be composed of the following components:

  • Directives

  • Actions

  • Scripting elements

Directives are typically enclosed in <%@ .... %>. For example, a JSP page directive may look like the following:

<%@ page language="java" %>

Actions are specified in standard XML notation. For example, an occurrence of the <jsp:useBean> action with a nested occurrence of the <jsp:setProperty> action may appear as follows:

<jsp:useBean id="newsfeed" class="com.wrox.begjsp.ch2.NewsFeed" scope="request" > <jsp:setProperty ...

Get Beginning JavaServer Pages™ 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.