Supported JSP Version 1.1 subsets

This section lists and describes the directives, implicit objects, scripting elements, and standard actions included in DB2 Everyplace JSP support.

Directives

Page directive

Description
The page directive defines page-dependent attributes.

Syntax
<%@ page page_directive_attr_list %>
page_directive_attr_list ::= 
{language="scriptingLanguage"}
{extends="className" }
{import="importList" }
{contentType="ctinfo" }

Attributes
The four valid attributes for this directive are:

Example
<%@ page contentType="text/html" %>

Include directive

Description
Use the include directive to include data in a JSP page. The included file may have elements which will also be processed.

Syntax
<%@ include file="relativeURLspec" %>

Attributes
The attribute for this directive is file which must be a page-relative path. The path cannot not start with a "/", and is to be interpreted relative to the current JSP page.

Example
<%@ include file="copyright.html" %>

Implicit objects

When you create JSP pages, you have access to certain implicit objects. They can be used within scriptlets and expressions, without first being declared. Each implicit object has a class defined in a core Java technology or com.ibm.db2e.jsp.server package, shown in Tabelle 13.

Tabelle 13. Implicit objects

Implicit Variable Type Representation Method Summary
request com.ibm.db2e.jsp.server.MiniHttpRequest The request for the JSP page.
java.lang.String getParameter(java.lang.String name)
java.lang.String getQueryString() 
response com.ibm.db2e.jsp.server.MiniHttpResponse The response to the request
java.lang.String encodeURL(java.lang.String url)
 void setDateHeader(java.lang.String name, long date)
 void setHeader(java.lang.String name, java.lang.String value) 
in java.io.BufferedReader This object is currently unavailable.
out java.io.PrintStream An object that writes into the Web browser.
config com.ibm.db2e.jsp.server.DB2eJspConfig The DB2eJspConfig for this JSP page.
java.lang.String getInitParameter(java.lang.String name)
exception java.lang.Throwable An exception thrown during execution of the JSP page.
Anmerkung:
Some of the types for the implicit objects above differ from those in JSP 1.1 due to the implementation of DB2 Everyplace JSP support.

Scripting elements

Declarations

Description
Use declarations to declare Java variables and methods used in a JSP page. Declarations are member variables (fields and methods) of the Java class for the JSP page.

Syntax
<%!declaration(s) %>

Example
<%!
String name = "Joe Smith";
 
public String getName() {
	return name;
} 
%>

Standard actions

<jsp:useBean>

Description
A jsp:useBean action associates an instance of a Java programming language object defined within the "page" scope available with a given id via a newly declared scripting variable of the same id.

Syntax
<jsp:useBean id="name" scope="page|request|session|application" typeSpec/>
typeSpec ::=
class="className"

Attributes
The three attributes for this tag are:

Example
<jsp:useBean id="masterViewDBBean" class="Query1HTMLResultsMasterViewBean" />

<jsp:setProperty>

Description
The jsp:setProperty action sets the value of properties in a Bean.

Syntax
<jsp:setProperty name="beanName" prop_expr />
prop_expr ::=
property="propertyName" value="propertyValue"
propertyValue ::= string
The value propertyValue can also be a request-time attribute value.
propertyValue ::= expr_scriptlet

Attributes
The three attributes for this tag are:

Example
<jsp:setProperty name="masterViewDBBean" property="username" 
value='<%=config.getInitParameter("username")%>' />

Scriptlets

Description
Use scriptlets to hold any valid Java code fragments. These code fragments are placed in the source code for the JSP page, and are relative to other elements of the JSP page.

Syntax
<% scriptlet %>

Example
<% 
try { 
String name = Query1DBBean.getString(1);
out.println("Name = " + name); 
} 
catch (SQLException e) { 
 
} 
%>

Expressions

Description
Expressions are string representations of data types. You can use expressions in queries and in HTML comments. The application evaluates the expressions at run-time and converts the expressions into strings.

Syntax
<%= expression %>

Example
<%= new java.util.Date() %>

Note: Variable names that begin with __db2ejsp__ are keywords and are used internally. Do not use these variables in the JSP page.

Zugehörige Konzepte

Zugehörige Tasks

Zugehörige Referenzen