May 2001
Intermediate to advanced
1088 pages
30h 13m
English
To create a custom JSP tag, you must first create a Java class that acts as a tag handler. Whenever your custom tag appears in a Java Server Page, the JSP engine invokes your tag handler. If your custom tag doesn't care about the body text between its opening and closing tags, you can use the simple TagSupport class, which implements the Tag interface. If you need to access and possibly change the body text within the opening and closing tags, you must subclass the BodyTagSupport class instead. The BodyTagSupport class implements the BodyTag interface, which allows you to access body text.
For example, suppose you define a custom tag named <mytags:DoSomething> and use it this way:
<mytags:DoSomething> Here is some text </mytags:DoSomething> ...
Read now
Unlock full access