BBJSP Page

Description

In BBj 16.0 and higher, the Page is one of the core elements of the BBJSP framework.

The Page format is an extension to HTML format where you can enrich the output by embedding BBj code within a Scriptlet; use the pre-defined library of Core Tag Library or create your own BBJSP Tag Libraries.

Business logic can be developed using the Command Engine and the Pipeline Engine.

Declarations

A declaration declares one or more variables or methods that you can use in your BBJ code later in the page. By convention it is recommended to place all declarations at the top of the BBJSP file. You can consider declared items as class variables or class methods.

Following is the syntax of a Declaration:

<%! declaration %>

Expressions

An expression element contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the final page. Because the value of an expression is converted to a String, you can use an expression within text, whether or not it is tagged with HTML. The expression element can contain any expression that is valid according to the BBJ Language Specification.

Following is the syntax of an Expression:

<%= expression %>

Comments:

Comments do not appear in the generated HTML markup sent to the browser. A comment is useful when you want to hide or "comment out" part of your page. Comments cannot be nested; that is to say, you cannot have one comment within another.

Following is the syntax of a Comment:

<%-- This is your comment --%>

If you want a comment to appear n the generated HTML then use a standard html comment syntax.

Following is the syntax of a HTML comment:

<!-- A comment -->

Directives

A directive affects the overall structure of the servlet class. It usually has the following form:

Following is the syntax of JSP Expression:

<%@ directive attribute="value" %>

There are three directive as follows:

Directive

Description

<%@ page ... %>

Defines page-dependent attributes, such as content-type, encoding and super-class that the page extends.

The following attributes are supported

 

contentType

describes the context type such as test/html;charset=UTF-8

 

extends

specified the base class that the page will extend

 

source

specified the source file containing the base class

<%@ include ... %>

Includes a file during the translation phase.

The following attributes are supported:

 

file

The name of the file to include

<%@ use ... %>

tells the code generator to generate a USE statement

The following attributes are supported

 

class

specified the base class that the page will extend

 

source

specified the source file containing the base class

Actions

BBJSP actions use constructs in XML syntax to control the behavior of the servlet engine. You can dynamically insert a file, reuse BBj components, forward the user to another page, or generate HTML for the BBj plugin.

Following is the syntax of BBJSP Actions:

<bbj:action_name attribute='value' /> 

Action elements are predefined functions as follows:

Action

Description

bbj:include

Includes a file at the time the page is requested

bbj:forward

Forwards the requester to a new page

bbj:redirect

Redirects the requester to a new page

Implicit Objects

BBJSP has several predefined objects. These are:

Object

Description

#Request!

This is the BBjspWebRequest object associated with the request.

#Response!

This is the BBjspWebResponse object associated with the response to the client.

#Session!

This is the BBjspWebSession object associated with the request.

#PageContext!

This is the BBjspPageContext that encapsulates use of server-specific features.

#BBjspSession!

This is the BBjspSessionData associated with the request.

These implicit objects can be accessed within a Scriptlet to assist in page generation.

Using Widgets

Embedding Widgets provides another way to use data-centric objects in your page. Each named widget in a page can be accessed through the BBJSP Expression Language to present and use data. For more information about using Widgets, see the BBJSP Widget Overview page.

See Also

BBJSP

BBjspPageContext

Scriptlet

Core Tag Library

BBJSP Widget Overview

BBJSP Expression Language