Creating a Tag with a Body

For your first step in creating a tag with a body, you must write the tag handler class. Using the helper class, you should extend the abstract class BodyTagSupport as shown in Listing 18.4 (DisplayItem.java).

Listing 18.4. DisplayItem.java
package com.gams.ejbs.item;

import java.io.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.sql.Date;

public class DisplayItem extends BodyTagSupport
{

Next, you must implement setters/getters, and the methods doStartTag(), doAfterBody(), and doEndTag() as shown here:

 private ItemValue item = null; private BodyContent bodyContent = null; public DisplayItem() { } public void setItem(ItemValue iv) { item = iv; } public void setBodyContent(BodyContent ...

Get BEA WebLogic Server™ 8.1 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.