Пример #1
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;
  }
Пример #2
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;
  }