Syntactic Elements of a JSP Page

This section describes syntactic elements of a JSP page: template data, JSP element, Directive element, Action element, Scripting element, Declaration element, Scriptlet element, Expression element.

From a syntactic point of view, a JSP page can be defined as:

JSP page
 |- Template Data
 |- JSP Element
     |- Directive Element
     |- Action Element
     |- Scripting Element
     	 |- Declaration Element
     	 |- Scriptlet Element
     	 |- Expression Element

There are two types of data in a JSP page:

There are three types of JSP elements:

Directive Element: A JSP element that provides global information for the conversion phase.

<%@ directive_name attribute=value ... %>

Action Element: A JSP element that provides actions for the execution phase.

<action_name attribute=value ...>action_body</action_name>
<action_name attribute=value .../>

Scripting Element: A JSP element that provides embedded Java statements. There are three types of scripting elements:

Declaration Element: A JSP element that provides the embedded Java declaration statements to be inserted into the Servlet class.

<%! Java declaration statements %>

Scriptlet Element: A JSP element that provides the embedded Java statements to be executed as part of the service method of the Servlet class. There are two ways to write a scriptlet element:

<% Java statements %>

Expression Element: A JSP element that provides the embedded Java expressions to be evaluated as part of the service method of the Servlet class. There are two ways to write an express element:

<%= Java expression %>

Last update: 2012.

Table of Contents

 About This Book

 JSP (JavaServer Pages) Overview

 Tomcat 7 Installation on Windows Systems

 JSP Scripting Elements

 Java Servlet Introduction

 JSP Implicit Objects

Syntax of JSP Pages and JSP Documents

Syntactic Elements of a JSP Page

 JSP Document - JSP Page in XML Format

 Writing Scriptlet Element in XML Format

 Writing Directive Element in XML Format

 Writing Action Element in XML Format

 "include" Directive and Action Elements

 Execution Result of CurrentTime.jspx

 JSP Application Session

 Managing Cookies in JSP Pages

 JavaBean Objects and "useBean" Action Elements

 Managing HTTP Response Header Lines

 Non-ASCII Characters Support in JSP Pages

 Performance of JSP Pages

 EL (Expression Language)

 Overview of JSTL (JSP Standard Tag Libraries)

 JSTL Core Library

 JSP Custom Tags

 JSP Java Tag Interface

 Custom Tag Attributes

 Multiple Tags Working Together

 File Upload Test Application

 Outdated Tutorials

 References

 PDF Printing Version