A couple of things I noticed.

1) Your HTML does not specify the count so the body is skipped.
2) You rely on the tag engine to do your looping. While this may work if the
engine is not correctly implemented then it won't. I would just do the
looping in the doAfterBody. That way you have all of the body contents and
you have the count.

Hope this helps.

-----Original Message-----
From: Namor Taror [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 12, 2001 5:58 PM
To: Orion-Interest
Subject: BodyTagSupport


Has anybody had any problems with the iterative tag execution? Even my 
simplest 'test' tag does not execute its body. doStartTag and doEndTag are 
executing fine but the doIntBody and doAfterBody are not execiting at all.

taglib.tld:

<tag>
<name>getCalendarList</name>
<tagclass>com.taror.schedule.taglib.calendar.CalendarList</tagclass>
<bodycontent>jsp</bodycontent>
<info>List...</info>


Class code:

public class LoopTag extends BodyTagSupport
{
        private int count;
        private int pos;

        public void setCount(int count)
        {
                this.count = count;
        }

        public int doStartTag()
        {
                if(count > 0)
                  return EVAL_BODY_TAG;
                else
                  return SKIP_BODY;
        }

        public int doAfterBody() throws JspException
        {
                // Iterate until the count's up
                if(++pos < count)
                return EVAL_BODY_TAG;
                else
                        return SKIP_BODY;
    }

        public int doEndTag() throws JspException
        {
                pos = 0;

                try
                {
                        if(bodyContent != null) // Check if we even entered
the body
        
bodyContent.writeOut(bodyContent.getEnclosingWriter());
                }
                catch(java.io.IOException e)
                {
                        throw new JspException("IO Error: " +
e.getMessage());
                }

                return EVAL_PAGE;
        }
}

JSP:

<%@ page session="false" %>
<%@ taglib uri="ScheduleUtil" prefix="schedule" %>
<html>
        <head>
                <title>Calendar List</title>
        </head>
        <body>
                <table>
                        <schedule:getCalendarList>
                                        <tr>
                                        <td>lksdjhg </td>
                                        </tr>
                        </schedule:getCalendarList>
                </table>
        </body>
</html>





_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


Reply via email to