Home > Articles > Open Source > Ajax & JavaScript

  • Print
  • + Share This

Custom Tag with Body Content

Anything besides comments and ignorable whitespace that appears between the start and end tags of an action element is referred to as "body content." A tag can be designed to ignore such content or to include it in the JSP output. Alternatively, the Tag Handler class can process, or "manipulate," the body content. The possible effects of that upon the JSP runtime result are endless. For example, the body content can be read as a string and used by the tag class. Another possibility is for the tag class to create entirely new content based on the existing body content and then append it to the output stream of the JSP. In a simple case, the tag can simply validate the body content and optionally include it in the output.

The content of a custom action element can be simple text, as shown here using the log tag featured in the Tomcat JSP examples, which you can try from its index HTML page:

<eg:log>
Remember to check for new release of bonForum!
</eg:log>

You can do much more with body content made up of JSP actions, scriptlets, and expressions, or of XML, HTML, or anything that JSP allows.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.