Ejemplo n.º 1
0
  /** @see javax.servlet.jsp.tagext.BodyTagSupport#doStartTag() */
  public int doStartTag() throws JspException {
    final String pageAccess = (String) pageContext.getAttribute("access");

    if ((pageAccess != null) && pageAccess.equals(Access.READONLY) && !forceReadWrite) {
      return SKIP_BODY;
    }

    // Recherche si un parent est du bon type
    Tag curParent = null;

    for (curParent = getParent(); (curParent != null) && !(curParent instanceof ColsTag); ) {
      curParent = curParent.getParent();
    }

    if (curParent == null) {
      throw new JspException("ColTag  must be used between Cols Tag.");
    }

    colsTag = (ColsTag) curParent;

    if (!GenericValidator.isBlankOrNull(colsTag.getEmptyKey())
        && (pageContext.getAttribute(colsTag.getId()) == null)) {
      return SKIP_BODY;
    } else {
      return EVAL_PAGE;
    }
  }
Ejemplo n.º 2
0
 protected AbsComponentTag getMyComponentParentTag() {
   Tag tagParent = this.getParent();
   while (tagParent != null) {
     if (tagParent instanceof AbsComponentTag) { // 如果当前父标签是框架的自定义标签
       return (AbsComponentTag) tagParent;
     }
     tagParent = tagParent.getParent();
   }
   return null;
 }
Ejemplo n.º 3
0
  /** @see railo.runtime.ext.tag.TagImpl#doStartTag() */
  public int doStartTag() throws JspException {

    // print.out("do start tag");
    Tag parent = this;
    do {
      parent = parent.getParent();
      if (parent instanceof Chartseries) {
        ((Chartseries) parent).addChartData(data);
        break;
      }
    } while (parent != null);
    return SKIP_BODY;
  }
Ejemplo n.º 4
0
  /** Process the tag. */
  public int doStartTag() throws JspException {
    if (!_hasValueSet) return EVAL_BODY_BUFFERED;

    PageContextImpl pageContext = (PageContextImpl) this.pageContext;

    Object value = _value;

    Tag parent = getParent();
    for (; parent != null && !(parent instanceof SQLExecutionTag); parent = parent.getParent()) {}

    if (parent == null) throw new JspException(L.l("sql:param requires sql:query parent."));

    SQLExecutionTag tag = (SQLExecutionTag) parent;

    tag.addSQLParameter(value);

    return SKIP_BODY;
  }
Ejemplo n.º 5
0
 /**
  * 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 void reuse(Tag handler) {
   synchronized (this) {
     if (current < (handlers.length - 1)) {
       handlers[++current] = handler;
       return;
     }
   }
   // There is no need for other threads to wait for us to release
   handler.release();
   if (annotationProcessor != null) {
     try {
       AnnotationHelper.preDestroy(annotationProcessor, handler);
     } catch (Exception e) {
       log.warn(
           "Error processing preDestroy on tag instance of " + handler.getClass().getName(), e);
     }
   }
 }
Ejemplo n.º 6
0
  /** Process the tag. */
  public int doEndTag() throws JspException {
    if (_hasValueSet) return EVAL_PAGE;

    String value;

    if (bodyContent != null) value = bodyContent.getString().trim();
    else value = "";

    Tag parent = getParent();
    for (; parent != null && !(parent instanceof SQLExecutionTag); parent = parent.getParent()) {}

    if (parent == null) throw new JspException(L.l("sql:param requires sql:query parent."));

    SQLExecutionTag tag = (SQLExecutionTag) parent;

    tag.addSQLParameter(value);

    return EVAL_PAGE;
  }