Apache taglibs

from Wikipedia, the free encyclopedia

Apache Taglibs (formerly Jakarta Taglibs ) is a project of the Apache Software Foundation . It consists of a collection of tag libraries ( libraries of tags ) and related projects. The most important part of this project is the reference implementation of the JSTL . There are also other tag libraries, which are described below.

Many of the tasks that are performed by the tags offered are not implemented as part of the presentation layer (JSP) in more modern web applications that are developed according to the MVC model , but as part of the application logic ( servlets or Enterprise JavaBeans ). For example, communication via JMS is usually not implemented as part of a JSP.

history

The project started in 2000 as Jakarta Taglibs . However, with the advent of JSTL , the core functionality of many libraries has been standardized and the demand for such libraries has decreased. As a result, large parts of the functions were discontinued and the remaining libraries were transferred to the Tomcat project in 2008 and 2009 . Only three of the once around 30 libraries are left: a standard library that contains various JSTL implementations, the Reusable Dialog Components Taglib RDC and an extended library that contains some non- standardized functions that are still desirable.

Historic Jakarta Taglibs

Benchmark

Benchmarks are standardized test procedures for determining running times. The benchmark subproject only provides two simple tags for performance measurements in JSPs.

This subproject provides the two tags " duration" and " exclude". " duration" Measures the time it takes to execute a JSP code between the two tag brackets. " exclude" Enables parts of the execution to be excluded from the measurement.

BSF (Bean Scripting Framework)

This sub-project forms an interface to the Bean Scripting Framework (BSF), another Jakarta project , which enables scripting languages to be executed by Java classes. This means that scripts can be embedded in JSP code.

Cache

This sub-project enables the simple caching of parts of JSPs, i.e. their intermediate storage when identical code parts are called up multiple times. It offers two simple tags called " cache" and " invalidate".

DateTime

This subproject develops tags that are useful for processing dates and times. For example, there is a day “ format” to format a date for display and a day “ parse” to create a date object from the content of an input field. In addition, functionality for dealing with different time zones and international date formats is offered.

These tags are in part similar to the time and date tags offered by the JSTL (e.g. " fmt:formatDate").

I18N (internationalization)

This sub-project provides tags for the internationalization of JSP applications, i.e. their translation into different languages. On the one hand, it contains tags for texting messages with the help of so-called “resource bundles”, which are normally stored in Java properties files . On the other hand, there are tags for formatting numbers, currencies and other things.

These tags are similar to the formatting tags defined by the JSTL , such as " fmt:bundle" and " fmt:message".

Input

The Input Tag Library provides tags for the simple pre-assignment of HTML form fields. For this purpose, the usual HTML input tags are replaced by appropriate tags, which make it easier for the JSP developer to check the contents of fields and to retain them between multiple calls to the same page.

IO

The IO tag library provides special tags available that allow, from JSPs out HTTP depose calls. “IO” stands for input / output , i.e. input and output. For example, there is a “ <request>” tag that enables a document to be obtained via HTTP and embedded in the calling page. An application example for this is inserting the original “ GNU License for Free Documentation ” (GFDL) into your own page with the following tag instead of just inserting a link.

<io:request url="http://www.gnu.org/copyleft/fdl.html"/>

JMS

The JMS custom tag library enables asynchronous messages to be sent and received from JavaServer Pages via the Java Message Service . It defines tags for establishing and clearing connections and for generating, sending and receiving messages. Received text messages can be integrated into the calling JSP.

JNDI

The JNDI tag library allows access to directory entries via the Java Naming and Directory Interface ( JNDI ). It provides tags for defining contexts (directory nodes) and for querying entries and their attributes.

log

This subproject defines tags that are used to output messages in log files using the log4j . There are tags for the different priorities " <debug>", " <info>", " <warn>", " <error>" and " <fatal>" as well as one named " <dump>" that logs the current values ​​of all variables in a JSP.

Mailer

This sub-project essentially provides a tag " mail" that represents an email to be sent . Additional tags are inserted in it to define the properties of the email, e.g. B. " message" for the actual message text. Some properties can also be set as tag attributes, such as: B. the recipient of the message.

Random

This sub-project provides two tags that can be used to generate random numbers (" <number>") or random strings (" <string>"). Each time the JSP is called, a new random value is generated and embedded in the page. The value ranges are freely definable.

RDC - Reusable Dialog Components

The sub-project Reusable Dialog Components (“ reusable dialog components ”) offers tags for dialog control of web applications via speech recognition and also the output via speech synthesis . The tags adhere to standards that were defined in the context of VoiceXML .

Regexp

This tag library essentially provides three tags for the most important regular expression applications .

  • " <existsMatch>" Expands its content when a regular expression is recognized in a previously defined variable.
  • " <substitute>" Replaces a regular expression in a variable with a given text.
  • " <split>" Splits the content of a variable into partial expressions, which are then expanded one after the other.

Scrape

This subproject provides tags that extract content from other websites (“ scrape together” ) and embed them in the JSP. The content that is extracted is defined by text fragments that are at the beginning and at the end of the code fragment of interest in the source page. The contents are buffered.

String

This subproject provides many tags for manipulating character strings, such as converting a character string into uppercase letters ( capitalize ) or filling a string with any characters up to a desired length ( rightPad ). The tags are based on the Jakarta project " commons lang ".

XTags

These tags allow the manipulation of XML documents and thus represent an alternative to XSLT implemented in JSP .

Web links