2 Replies Latest reply on Jul 1, 2003 10:49 AM by zxue

    JBOSS 3.2.1 / Jetty and Tag Support

    roberto roberto Novice

      The servlet engine doesn't call the release method on tags every time is used from jsp pages.

      This because a pool is used .

      this is the servlet code generated from a jsp

      ....
      private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_ABSTag_CustomButton_xmlDocument_scope;
      ....
      /* ---- ABSTag:CustomButton ---- */
      com.dat.abs.web.tags.ABSCustomButtonTag _jspx_th_ABSTag_CustomButton_0 = (com.dat.abs.web.tags.ABSCustomButtonTag) _jspx_tagPool_ABSTag_CustomButton_xmlDocument_scope.get(com.dat.abs.web.tags.ABSCustomButtonTag.class);
      _jspx_th_ABSTag_CustomButton_0.setPageContext(pageContext);
      _jspx_th_ABSTag_CustomButton_0.setParent(_jspx_th_ABSTag_ButtonBody_0);
      _jspx_th_ABSTag_CustomButton_0.setXmlDocument(vXmlDocument);
      _jspx_th_ABSTag_CustomButton_0.setScope(vScope);
      int _jspx_eval_ABSTag_CustomButton_0 = _jspx_th_ABSTag_CustomButton_0.doStartTag();
      if (_jspx_th_ABSTag_CustomButton_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
      return;
      _jspx_tagPool_ABSTag_CustomButton_xmlDocument_scope.reuse(_jspx_th_ABSTag_CustomButton_0)

      ....

      the method "reuse" on TagHandlerPool is..

      /**
      * Adds the given tag handler to this tag handler pool, unless this tag
      * handler pool has already reached its capacity, in which case the tag
      * handler's release() method is called.
      *
      * @param handler Tag handler to add to this tag handler pool
      */
      public synchronized void reuse(Tag handler) {
      if (current < (handlers.length - 1))
      handlers[++current] = handler;
      else
      handler.release();
      }


      so only when handler pool has already reached its capacity the tag's release() method is called.

      From the sun javadoc about interface javax.servlet.jsp.tagext.Tag:

      "Called on a Tag handler to release state. The page compiler guarantees that JSP page implementation objects will invoke this method on all tag handlers".


      This cause that the global internal variable of the tag are not "clear".
      It's a jetty bug ? or i can't use internal variable (or i must reset it)
      There is no problem this optional tag attributes, because a pool is created for each combination of tag/arguments passed.

      ty
      Roberto