1 Reply Latest reply on Sep 21, 2002 10:29 PM by mgillam

    JSP Tags generating bad code in JBoss 3.0.x

    mgillam

      I have a custom tag library that works fine in prior releases of JBoss 2.x/Tomcat.

      I downloaded JBoss 3.0.2 w/Jetty, and JBoss 3.0.0 w/Tomcat and the tag precompilation seems to be wrong.

      The following show how Jasper generates different code between JB 3.x and JB 2.x.

      A simple tag that fails:


      button
      com.moose.tags.BopButton
      JSP

      Generates a button/action "name".


      name
      true




      Using JBoss3.0.2/Jetty where it fails:
      // begin [file="/entity_main.jsp";from=(72,0);to=(72,25)]
      /* ---- bop:button ---- */
      com.moose.tags.BopButton _jspx_th_bop_button_1 = new com.moose.tags.BopButton();
      _jspx_th_bop_button_1.setPageContext(pageContext);
      _jspx_th_bop_button_1.setParent(_jspx_th_bop_template_0);
      _jspx_th_bop_button_1.setName("New");
      try {
      int _jspx_eval_bop_button_1 = _jspx_th_bop_button_1.doStartTag();
      // end
      // begin [file="/entity_main.jsp";from=(72,0);to=(72,25)]
      if (_jspx_th_bop_button_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
      return;
      } finally {
      _jspx_th_bop_button_1.release();
      }
      // end
      // HTML //

      Using JB 2.x/Tomcat where it works:
      // begin [file="/entity_main.jsp";from=(71,0);to=(71,26)]
      /* ---- bop:button ---- */
      com.moose.tags.BopButton _jspx_th_bop_button_0 = new com.moose.tags.BopButton();
      _jspx_th_bop_button_0.setPageContext(pageContext);
      _jspx_th_bop_button_0.setParent(_jspx_th_bop_template_0);
      _jspx_th_bop_button_0.setName("Save");
      try {
      int _jspx_eval_bop_button_0 = _jspx_th_bop_button_0.doStartTag();
      if (_jspx_eval_bop_button_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
      try {
      if (_jspx_eval_bop_button_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
      out = pageContext.pushBody();
      _jspx_th_bop_button_0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
      }
      _jspx_th_bop_button_0.doInitBody();
      do {
      // end
      // begin [file="/entity_main.jsp";from=(71,0);to=(71,26)]
      } while (_jspx_th_bop_button_0.doAfterBody() == javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);
      } finally {
      if (_jspx_eval_bop_button_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
      out = pageContext.popBody();
      }
      }
      if (_jspx_th_bop_button_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
      return;
      } finally {
      _jspx_th_bop_button_0.release();
      }
      // end


      As you can see, the failing code does not generate as much code, including ....
      _jspx_th_bop_button_0.doAfterBody()

      which generates the HTML.

      I noticed JB 2.x includes jasper.jar, and JB 3.x includes org.apache.jasper.jar.

      Anybody have any ideas? I developed this in a vacuum so I'm open to the possibility that I'm doing something dumb that has been working by accident.

        • 1. Re: JSP Tags generating bad code in JBoss 3.0.x
          mgillam

          As Rosanne Rosannadanna used to say on SNL "Never mind!".

          I was burnt by an optimization (and stricter adherence to the standard) made in Jasper code generation. I was extending BodyTagSupport on tags that have no "body". It used to call doAfterBody() even if the tag had no body. They trimmed that code out.