Example usage for javax.servlet.jsp.tagext IterationTag EVAL_BODY_AGAIN

List of usage examples for javax.servlet.jsp.tagext IterationTag EVAL_BODY_AGAIN

Introduction

In this page you can find the example usage for javax.servlet.jsp.tagext IterationTag EVAL_BODY_AGAIN.

Prototype

int EVAL_BODY_AGAIN

To view the source code for javax.servlet.jsp.tagext IterationTag EVAL_BODY_AGAIN.

Click Source Link

Document

Request the reevaluation of some body.

Usage

From source file:org.apache.cactus.extension.jsp.JspTagLifecycle.java

/**
 * Internal method to invoke a tag without doing exception handling.
 * //from   ww w  .ja va 2 s.  co  m
 * @throws JspException If the tag throws an exception
 * @throws IOException If an error occurs when reading or writing the body
 *         content
 */
private void invokeInternal() throws JspException, IOException {
    int status = this.tag.doStartTag();
    if (this.tag instanceof IterationTag) {
        if (status != Tag.SKIP_BODY) {
            BodyContent body = null;
            try {
                IterationTag iterationTag = (IterationTag) this.tag;
                if ((status == BodyTag.EVAL_BODY_BUFFERED) && (this.tag instanceof BodyTag)) {
                    BodyTag bodyTag = (BodyTag) this.tag;
                    body = pageContext.pushBody();
                    if (log.isDebugEnabled()) {
                        log.debug("Pushed body content [" + body.getString() + "]");
                    }
                    bodyTag.setBodyContent(body);
                    bodyTag.doInitBody();
                }
                int iteration = 0;
                do {
                    fireEvalBody(iteration, body);
                    if (log.isDebugEnabled()) {
                        log.debug("Body evaluated for the [" + iteration + "] time");
                    }
                    status = iterationTag.doAfterBody();
                    iteration++;
                } while (status == IterationTag.EVAL_BODY_AGAIN);
                if (log.isDebugEnabled()) {
                    log.debug("Body skipped");
                }
                fireSkipBody();
            } finally {
                if (body != null) {
                    if (log.isDebugEnabled()) {
                        log.debug("Popping body content [" + body.getString() + "]");
                    }
                    pageContext.popBody();
                    body = null;
                }
            }
        } else {
            if (log.isDebugEnabled()) {
                log.debug("Body skipped");
            }
            fireSkipBody();
        }
    }
    status = tag.doEndTag();
}

From source file:org.seasar.mayaa.impl.engine.processor.JspProcessor.java

protected ProcessStatus getProcessStatus(int status, boolean doStart) {
    if (status == Tag.EVAL_BODY_INCLUDE) {
        return _forceBodySkip ? ProcessStatus.SKIP_BODY : ProcessStatus.EVAL_BODY_INCLUDE;
    } else if (status == Tag.SKIP_BODY) {
        return ProcessStatus.SKIP_BODY;
    } else if (status == Tag.EVAL_PAGE) {
        return ProcessStatus.EVAL_PAGE;
    } else if (status == Tag.SKIP_PAGE) {
        return ProcessStatus.SKIP_PAGE;
    } else if (!doStart && status == IterationTag.EVAL_BODY_AGAIN) {
        return ProcessStatus.EVAL_BODY_AGAIN;
    } else if (doStart && status == BodyTag.EVAL_BODY_BUFFERED) {
        return _forceBodySkip ? ProcessStatus.SKIP_BODY : ProcessStatus.EVAL_BODY_BUFFERED;
    }//from  w  ww.j  a v a 2s . c  o  m
    throw new IllegalArgumentException();
}