You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rich Sneiderman <rs...@infinera.com> on 2002/03/18 18:30:20 UTC

RE: Tomcat 4.0 and IterationTag

I haven't implemented on of these yet but it sounds like you should be
inheriting from BodyTagSupport not TagSupport.

- Rich

-----Original Message-----
From: Albert Pastrana [mailto:albert@canaldeporte.com] 
Sent: Monday, March 18, 2002 9:25 AM
To: tomcat-list
Subject: Tomcat 4.0 and IterationTag


Hi,

I've a tomcat 4.0 (downloaded latest week) in a Win2k pro.

I've a little problem running it as service, but running stand-alone
everything it's right.

The first problem comes when creating an iteration tag. I've followed
many explanations and, of course, read all the javadocs, and I cannot
understand what I'm doing wrong.

My code is something like that:

public class RepeatTag
extends      TagSupport
{
   int num = 0;

   boolean endLoop()   { return num==10; }
   void    nextElement() { num++;  }

   public int doStartTag() throws JspException {
      if (!endLoop()) {
         nextElement();
         return EVAL_BODY_AGAIN;
     }
     return SKIP_BODY;
   }

   public int doAfterBody() throws JspException {
      if (!endLoop()) {
         nextElement();
         return EVAL_BODY_AGAIN;
      } else {
         return SKIP_BODY;
      }
  }

} //end class RepeatTag

And the problem is that my Tomcat is saying me that exception:
"javax.servlet.ServletException: Since tag handler class
com.ludicus.general.taglib.RepeatTag does not implement BodyTag, it
can't return BodyTag.EVAL_BODY_TAG"

I've read a lot of documentation about JSP1.2 and I think that's the
right solution, but I supose I'm doing something wrong, could anyone
tell me what's the problem?

thanks a lot

  albert


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Tomcat 4.0 and IterationTag

Posted by Albert Pastrana <al...@canaldeporte.com>.
Yes, I thought the same, because I did a similar tag some months ago, but I
looked at the JSP1.2 specification and docs and I saw that now, TagSupport
is implementing IterationTag (a new interface) and that the right way (the
other will be deprecated) to do an iteration tag is extending TagSupport.

thanks

----- Original Message ----- 
From: "Rich Sneiderman" <rs...@infinera.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Monday, March 18, 2002 6:30 PM
Subject: RE: Tomcat 4.0 and IterationTag


> I haven't implemented on of these yet but it sounds like you should be
> inheriting from BodyTagSupport not TagSupport.
> 
> - Rich
> 
> -----Original Message-----
> From: Albert Pastrana [mailto:albert@canaldeporte.com] 
> Sent: Monday, March 18, 2002 9:25 AM
> To: tomcat-list
> Subject: Tomcat 4.0 and IterationTag
> 
> 
> Hi,
> 
> I've a tomcat 4.0 (downloaded latest week) in a Win2k pro.
> 
> I've a little problem running it as service, but running stand-alone
> everything it's right.
> 
> The first problem comes when creating an iteration tag. I've followed
> many explanations and, of course, read all the javadocs, and I cannot
> understand what I'm doing wrong.
> 
> My code is something like that:
> 
> public class RepeatTag
> extends      TagSupport
> {
>    int num = 0;
> 
>    boolean endLoop()   { return num==10; }
>    void    nextElement() { num++;  }
> 
>    public int doStartTag() throws JspException {
>       if (!endLoop()) {
>          nextElement();
>          return EVAL_BODY_AGAIN;
>      }
>      return SKIP_BODY;
>    }
> 
>    public int doAfterBody() throws JspException {
>       if (!endLoop()) {
>          nextElement();
>          return EVAL_BODY_AGAIN;
>       } else {
>          return SKIP_BODY;
>       }
>   }
> 
> } //end class RepeatTag
> 
> And the problem is that my Tomcat is saying me that exception:
> "javax.servlet.ServletException: Since tag handler class
> com.ludicus.general.taglib.RepeatTag does not implement BodyTag, it
> can't return BodyTag.EVAL_BODY_TAG"
> 
> I've read a lot of documentation about JSP1.2 and I think that's the
> right solution, but I supose I'm doing something wrong, could anyone
> tell me what's the problem?
> 
> thanks a lot
> 
>   albert
> 
> 
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>