Start of Content Area

Background documentation JSP Syntax Elements Outline  Locate the document in its SAP Library structure

JSP Directives

Standard JSP directives are page, include and taglib. Usually, they provide information that is global for the corresponding JSP. Directives do not write output to the HTTP response.

From the JSP life-cycle perspective, directives are processed at page translation time. The information provided by them is made available to the JSP implementation class; therefore, it is regarded as global and is applied to all client requests that this implementation class serves.

In the body of your JSP page, directives are placed between the <%@ and %> symbols.

JSP Actions

Standard JSP action elements are: include, forward, useBean, getProperty, setProperty, param and plugin. You can usually use them to work with Java objects. You can use scripting elements inside action elements to call methods or access variables of those objects.

From the JSP life-cycle perspective, action elements are processed when the JSP page is requested.

In the body of your JSP page, actions are enclosed between the <jsp:action_type and /> symbols. If your action provides a body, it is enclosed between the <jsp:action_type> and </jsp:action_type> tags.

JSP Scripting Elements

They are divided into three different types - declarations, scriptlets and expressions.

Declarations

You can use declarations to declare variables or methods, instantiate objects and so on. The body of the declarations is inserted in the JSP implementation class at method level (that is, as separate methods or variables, and not inside the service method, for example). Declarations are also processed at page translation time. They are enclosed between <%! and %> symbols.

Declarations do not write output to the HTTP response, too.

Scriptlets

You can use scriptlets to enter Java code. The variables and methods that you have declared in a declaration element in this page are available to the scriplets you use for the same page. The Java code that you write in a scriptlet is inserted in the body of the service method of the JSP implementation class.

Scriptlets are enclosed between <% and %> symbols.

They are processed when the JSP page is requested.

Expressions

You can use expressions to insert valid Java expressions in the response body. The expressions are evaluated first, and then the result is converted into a string and written to the output stream.

Expressions are also processed at page request time.

They are enclosed between <%=and %> symbols.

 

End of Content Area