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.
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.
Follow these steps to configure your web application with this tag library:
<taglib> <taglib-uri>http://jakarta.apache.org/taglibs/bsf-1.0</taglib-uri> <taglib-location>/WEB-INF/bsf.tld</taglib-location> </taglib>
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.
expression | Run a BSF expression. |
scriptlet | Run a BSF script. |
expression | Availability: 1.0 | ||||
This tag is the BSF taglib equivalent of the "<%=" JSP tag. |
|||||
Tag Body | tagdependent | ||||
Restrictions | None | ||||
Attributes | Name | Required | Runtime Expression Evaluation | Availability | |
language | Yes | No | 1.0 | ||
Defines the scripting language used within the body of the tag. |
|||||
Variables | None | ||||
Examples | Ouput the current date. | ||||
|
scriptlet | Availability: 1.0 | ||||
This tag is the BSF taglib equivalent of the "<%"^M JSP tag. |
|||||
Tag Body | tagdependent | ||||
Restrictions |
|
||||
Attributes | Name | Required | Runtime Expression Evaluation | Availability | |
language | Yes | No | 1.0 | ||
Defines the scripting language used within the body of the tag. |
|||||
Variables | None | ||||
Examples | Print Hello World using tcl as the scripting language. | ||||
|
See the example application bsf-examples.war for examples of the usage of the tags from this custom tag library.
Java programmers can view the java class documentation for this tag library as javadocs.
Review the complete revision history of this tag library.