This isn't really an answer to your question, but a tip anyway.
If you don't plan to manipulate the body of the tag, which you do not in
the code below, you can consider inheriting TagSupport instead of
BodyTagSupport. A normal (TagSupport) tag can have a body, but you can
not get the contents of the body from inside the tag.

You can then skip doInitBody() and doAfterBody(). Instead use
doStartTag() and doEndTag().

  Mattias Jiderhamn
  Expert Systems
  [EMAIL PROTECTED]


> -----Original Message-----
> From: Dinesh, S. [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 22, 2001 3:30 AM
> Subject: TAGLIB - Output doesn't seem to work
>
> Hi All,
>
> It's me again. My taglib doesn't seem to be writing out to the JSP
Page.
> Code follows.
>
> Please kindly advice.
>
> Thank you.
>
>
> Dinesh, S.
>
>
------------------------------------------------------------------------
----
> ----
> package com.jcs.db.dbase;
>
> import java.util.*;
> import java.io.IOException;
> import javax.servlet.jsp.*;
>
> public class dBaseTag extends BodyTagSupport{
>   private String _id        = null;
>   private String _name      = null;
>
>   public void setId(String id)
>
>     _id=id;
>     if (_name==null) _name=id;
>   }
>   public String getId()
>
>     return _id;
>   }
>   public void setName(String name)
>
>     _name=name;
>     if (_id==null) _id=name;
>   }
>   public String getName()
>
>     return _name;
>   }
>
>   public int doStartTag() throws JspTagException {
>     try {
>       pageContext.getOut().print("Start of the Hello.");
>          } catch (IOException e) {
>           throw new JspTagException("Fatal IOException!");
>         }
>     return EVAL_BODY_TAG;
>   }
>   public void doInitBody() throws JspException {}
>
>   public int doAfterBody() throws JspTagException {
>     try {
>           JspWriter out = pageContext.getOut();
>       out.println("End of the Hello");
>          } catch (IOException e) {
>           throw new JspTagException("Fatal IOException!");
>         }
>   }
>   public int doEndTag() {
>     return EVAL_BODY_TAG;
>   }
>   public void release() {
>     _id    = null;
>     _name  = null;
>   }
> }

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to