The JSP specification provides a Tag Extension mechanism (see Chapter 5) that enables the 
addition of new actions, thus allowing the JSP page  language  to be easily extended in a 
portable
 fashion. A typical example would be elements to support embedded database 
queries. Tag libraries can be used by JSP page authoring tools and can be distributed along 
with JSP pages to any JSP container like Web and Application servers.
The Tag Extension mechanism can be used from JSP pages written using any valid scripting 
language, although the mechanism itself only assumes a Java run time environment. Custom 
actions provide access to the attribute values and to their body; they can be nested and their 
bodies can include scripting elements.
1.4.6
Scripting Languages
Scripting elements
 are commonly used to manipulate objects and to perform computation that 
affects the content generated. There are three classes of scripting elements: 
declarations
, 
scriptlets
 and 
expressions. Declarations 
are used to declare scripting language constructs that 
are available to all other scripting elements. 
Scriptlets
 are used to describe actions to be 
performed in response to some request. Scriplets that are program fragments can also be used 
to do things like iterations and conditional execution of other elements in the JSP page. 
Expressions
 are complete expressions in the scripting language that get evaluated at response 
time; commonly the result is converted into a string and then inserted into the output stream.
All JSP containers must support scripting elements based on the Java programming language. 
Additionally, JSP containers may also support other scripting languages. All such scripting 
languages must support:
Manipulation of Java objects.
Invocation of methods on Java objects.
Catching of Java language exceptions.
The precise definition of the semantics for scripting done using elements based on the Java 
programming language is given in Chapter 4.
The semantics for other scripting languages are not precisely defined in this version of the 
specification, which means that portability across implementations cannot be guaranteed. 
Precise definitions may be given for other languages in the future.
1.4.7
Objects and Variables
An object may be made accessible to code in the scripting elements through a scripting 
language variable. An element can define scripting variables in two places: after its start tag 
and after its end tag. The variables will contain at process request time a reference to the 
object defined by the element, although other references exist depending on the 
scope
 of the 
object (see Section 1.4.3,  Objects and Scopes ).
Chapter 1
Overview
26




JSP Web Hosting JavaServer Pages Specifications JSP Hosting




 
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved.