Prototype (and Scriptaculous) JSP Taglib

Trying to use Prototype and Scriptaculous in your J2EE Application? Well, stop coding Javascript directly and use these tag libraries. The Prototype JSP tag library is a set of tags that are derived from the Javascript helpers and generators available in the Ruby on Rails framework. These tags encapsulate 90% of the Javascript you will need to create a very dynamic application.

This component makes it easier to use the Prototype JS library in JSP pages. The Prototype Javascript Library is an AJAX library made popular by Ruby on Rails, and this JSP tag library is an attempt to recreate some of the rails helpers for people writing JSP pages.

The Tags

This tag library presents the following tags (assuming a prefix of proto:):

  • proto:formRemote - Similar to Rails' form_remote helper. This tag creates a FORM tag with the necessary Javascript to make a remote request and updte a target DIV.
  • proto:linkRemote - Similar to Rails' link_remote helper. This tag provides a way to create an anchor tag that hits a remote server and updates a target DIV.
  • proto:observeField - This tag is similar to the observe_field helper in Rails. It provides way to periodically observe an input field for changes, to act upon those changes, and update a target DIV.
  • proto:periodicUpdate - Similar to Rails' periodic_update helper, this tag periodically requests a document from remote server and updates a trget DIV