Documentation for the BSF Tag Library

1. INTRODUCTION

The BSF (Bean Scripting Framework) Tag Library enables JSP writers to write the code portion of their JSP in languages other than Java.

For a much more detailed description of BSF itself see http://alphaworks.ibm.com/tech/bsf, but here are a few key excerpts:

The Bean Scripting Framework (BSF) is an architecture for incorporating scripting into Java applications and applets. Scripting languages such as Netscape Rhino (Javascript), VBScript, Perl, Tcl, Python, NetRexx and Rexx are commonly used to augment an application's function or to script together a set of application components to form an application.

BSF supports both directions of scripting: in one case where the Java-side is in charge and runs/evaluates scripts at will, and in the other case the script runs and controls Java beans. Notice that while we use the word "bean", it is used loosely - BSF works with any Java object and not just a true bean.

BSF defines a set of JSP objects available as beans that are available for the scriptlet to use:

request
response
pageContext
application
out
config
page
exception
session

The BSF taglib also allows JSP writers to use multiple scripting languages within the same JSP document.

2. PREREQUISITE SOFTWARE

3. CONFIGURATION INFORMATION

Follow these steps to configure your web application with this tag library:

To use the tags from this library in your JSP pages, add the following directive at the top of each page:

    <%@ taglib uri="http://jakarta.apache.org/taglibs/bsf-2.0" prefix="x" %>

where "x" is the tag name prefix you wish to use for tags from this library. You can change this value to any prefix you like.

4. TAG DOCUMENTATION

The BSF tag library includes several tags, with the following characteristics:

4.1 The "scriptlet" tag

This tag is the BSF taglib equivalent of the "<%" JSP tag. There is one required attribute, "language", which defines the language used in that section of the JSP. For example:

<bsf:scriptlet language="tcl">
$out println "Hello world"
</bsf:scriptlet>

4.2 The "expression" tag

This tag is the BSF taglib equivalent of the "<%=" JSP tag. This is one required attribute, "language", which defines the language used in that section of the JSP. For example:

<bsf:expression language="perlscript">
CreateBean("java.util.Date")
</bsf:expression>

5. USAGE EXAMPLES

See the example JSP (bsf-examples\temps.jsp) for an example of the usage of the tags from this custom tag library.