2010-04-14 - Jakarta Taglibs has been retired.

For more information, please explore the Attic.

Jakarta Project: BSF Tag library

Version: 1.0

Table of Contents

Overview

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://jakarta.apache.org/bsf/, but here are a few key excerpts:

The Bean Scripting Framework (BSF) is a set of Java classes which provides scripting language support within Java applications, and access to Java objects and methods from scripting languages.

The standard set of JSP implicit objects is available within BSF. These implicit objects must be used for input and output with respect to the generated page, since the scripting languages do not have any awareness of having been called within a JSP. For example, in order to print a line of text into the page generated by the JSP, one must use the println() method of the out implicit object.

BSF supports several scripting languages currently:

In addition, the following languages are supported with their own BSF engines:

Information on where to obtain scripting languages for use with BSF is available on the BSF Related Projects page.

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

Requirements

This custom tag library requires no software other than a servlet container that supports the JavaServer Pages Specification, version 1.1 or higher. And Version 2.2 of the Bean Scripting Framework.

Configuration

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-1.0" prefix="bsf" %>

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

Tag Summary

BSF Tags
expressionRun a BSF expression.
scriptlet Run a BSF script.
 

Tag Reference

expression Availability: 1.0

This tag is the BSF taglib equivalent of the "<%=" JSP tag.

Tag Bodytagdependent    
Restrictions None
AttributesNameRequired Runtime Expression Evaluation Availability
 language  Yes   No  1.0
 

Defines the scripting language used within the body of the tag.

VariablesNone
Examples Ouput the current date.  
 


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

scriptlet Availability: 1.0

This tag is the BSF taglib equivalent of the "<%"^M JSP tag.

Tag Bodytagdependent    
Restrictions

AttributesNameRequired Runtime Expression Evaluation Availability
 language  Yes   No  1.0
 

Defines the scripting language used within the body of the tag.

VariablesNone
Examples Print Hello World using tcl as the scripting language.  
 


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

Examples

See the example application bsf-examples.war for examples of the usage of the tags from this custom tag library.

Java Docs

Java programmers can view the java class documentation for this tag library as javadocs.

Revision History

Review the complete revision history of this tag library.