tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Switch" <>
Subject Could this be a Tag Libs implementation bug?
Date Tue, 04 Feb 2003 10:09:53 GMT
Hello everybody.

I've just signed up this list, then I must present myselft first.
My name is Paco. I'm a J2EE developer for a local SW copany at Balearic
Islands (Spain - Europe).

I apologize me for my english. I write as well as I can :-)
I've read the etiquette and I've read the FAQ and I've read the mail
archieve, without having found an explanation to my problem.

Here it goes:

I've developed a small "iterate" TagLib. This Tag Lib works fine with WL and
Oracle iAS and I'm currently migrating to jboss + tomcat.

At the end of this e-mail I'will paste some code to explain properly why I
think there's a bug.
I've created a very simple JSP that tests my "IterateTag" and I get a
"NullPointerException" because of the EVAL_BODY_INCLUDE returned by

I've been looking ".java" generated file from ".jsp" and I can see this
piece of code:

 int _jspx_eval_bit_iterate_0 = _jspx_th_bit_iterate_0.doStartTag();
 if (_jspx_eval_bit_iterate_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
   String str = null;
   if (_jspx_eval_bit_iterate_0 !=
javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
     javax.servlet.jsp.tagext.BodyContent _bc = pageContext.pushBody();
     out = _bc;
     str = (String) pageContext.findAttribute("str");
   do {
     if (evalDoAfterBody !=
   } while (true);
   if (_jspx_eval_bit_iterate_0 !=
     out = pageContext.popBody();

I can't undestand why this generated ".java" file executes "if !=
EVAL_BODY_INCLUDE" and I think it should be "if == EVAL_BODY_INCLUDE" (May
be I'm wrong).

I've read the following at J2EE 1.3 javadoc about BodyTagSupport class

public static final int EVAL_BODY_INCLUDE

Evaluate body into existing out stream. Valid return value for doStartTag

I can workarround this by returning EVAL_BODY_BUFFERED (so this isn't a
critical error)

Could anybody explain why is _jspx_eval_bit_iterate_0 being compared to be

Tell me if you need something else.

Thanks in advance for your help.

Some source code for ""
public int doStartTag() throws JspTagException
    if(iterator==null) return SKIP_BODY;
      Enumeration en =
      while (en.hasMoreElements()) System.out.println("Attributute: " +
      return EVAL_BODY_INCLUDE;
    else return SKIP_BODY;

  public int doAfterBody() throws JspTagException
    System.out.println("IterateTag.doAfterBody. name: " + name + "
Iteratior: " + iterator + "Type: " + type);
      return EVAL_BODY_AGAIN;
      return SKIP_BODY;

  public int doEndTag() throws JspTagException
    System.out.println("IterateTag.doEndTag. name: " + name + " Iteratior: "
+ iterator + "Type: " + type);
      if(bodyContent != null)
    catch( e)
      throw new JspTagException("IO Error: " + e.getMessage());
    System.out.println("Fin IterateTag.doEndTag. ");
    return EVAL_PAGE;

Some source code for a JSP test file:
<%@ page contentType="text/html;charset=ISO-8859-15"%>
<%@ page import="java.util.*" %>
<%@ taglib uri="mytags" prefix="bit" %>
  Vector v = new Vector();
  v.addElement("First Element");
  v.addElement("Second Element");
  v.addElement("Third Element");
  v.addElement("Fourth Element");
      <bit:iterate name="str" collection="<%=v%>" type="String">
        <tr><td>This items contains <%=str.length()%> characters and its
value is <%=str%></td></tr>

taglib.tld contents:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library
1.1//EN" "">
	<info>Iterate Tag Lib.</info>
		<info>a simple iterator</info>

Yahoo! Móviles
Personaliza tu móvil con tu logo y melodía favorito 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message