All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.servlet.jsp.tagext.IterationTag Maven / Gradle / Ivy

/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
 *
 * The contents of this file are subject to the terms of either the GNU
 * General Public License Version 2 only ("GPL") or the Common Development
 * and Distribution License("CDDL") (collectively, the "License").  You
 * may not use this file except in compliance with the License.  You can
 * obtain a copy of the License at
 * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
 * or packager/legal/LICENSE.txt.  See the License for the specific
 * language governing permissions and limitations under the License.
 *
 * When distributing the software, include this License Header Notice in each
 * file and include the License file at packager/legal/LICENSE.txt.
 *
 * GPL Classpath Exception:
 * Oracle designates this particular file as subject to the "Classpath"
 * exception as provided by Oracle in the GPL Version 2 section of the License
 * file that accompanied this code.
 *
 * Modifications:
 * If applicable, add the following below the License Header, with the fields
 * enclosed by brackets [] replaced by your own identifying information:
 * "Portions Copyright [year] [name of copyright owner]"
 *
 * Contributor(s):
 * If you wish your version of this file to be governed by only the CDDL or
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
 * elects to include this software in this distribution under the [CDDL or GPL
 * Version 2] license."  If you don't indicate a single choice of license, a
 * recipient has the option to distribute your version of this file under
 * either the CDDL, the GPL Version 2 or to extend the choice of license to
 * its licensees as provided above.  However, if you add GPL Version 2 code
 * and therefore, elected the GPL Version 2 license, then the option applies
 * only if the new code is made subject to such option by the copyright
 * holder.
 *
 *
 * This file incorporates work covered by the following copyright and
 * permission notice:
 *
 * Copyright 2004 The Apache Software Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package javax.servlet.jsp.tagext;

import javax.servlet.jsp.*;

/**
 * The IterationTag interface extends Tag by defining one additional
 * method that controls the reevaluation of its body.
 *
 * 

A tag handler that implements IterationTag is treated as one that * implements Tag regarding the doStartTag() and doEndTag() methods. * IterationTag provides a new method: doAfterBody(). * *

The doAfterBody() method is invoked after every body evaluation * to control whether the body will be reevaluated or not. If doAfterBody() * returns IterationTag.EVAL_BODY_AGAIN, then the body will be reevaluated. * If doAfterBody() returns Tag.SKIP_BODY, then the body will be skipped * and doEndTag() will be evaluated instead. * *

Properties * There are no new properties in addition to those in Tag. * *

Methods * There is one new methods: doAfterBody(). * *

Lifecycle * *

Lifecycle details are described by the transition diagram * below. Exceptions that are thrown during the computation of * doStartTag(), BODY and doAfterBody() interrupt the execution * sequence and are propagated up the stack, unless the tag handler * implements the TryCatchFinally interface; see that interface for * details. * *

* Lifecycle Details Transition Diagram for IterationTag * *

Empty and Non-Empty Action *

If the TagLibraryDescriptor file indicates that the action must * always have an empty element body, by a <body-content> entry of * "empty", then the doStartTag() method must return SKIP_BODY. * *

Note that which methods are invoked after the doStartTag() depends on * both the return value and on if the custom action element is empty * or not in the JSP page, not on how it's declared in the TLD. * *

* If SKIP_BODY is returned the body is not evaluated, and then doEndTag() * is invoked. * *

* If EVAL_BODY_INCLUDE is returned, and the custom action element is not * empty, the body is evaluated and "passed through" to the current out, * then doAfterBody() is invoked and, after zero or more iterations, * doEndTag() is invoked. */ public interface IterationTag extends Tag { /** * Request the reevaluation of some body. * Returned from doAfterBody. * * For compatibility with JSP 1.1, the value is carefully selected * to be the same as the, now deprecated, BodyTag.EVAL_BODY_TAG, * */ public final static int EVAL_BODY_AGAIN = 2; /** * Process body (re)evaluation. This method is invoked by the * JSP Page implementation object after every evaluation of * the body into the BodyEvaluation object. The method is * not invoked if there is no body evaluation. * *

* If doAfterBody returns EVAL_BODY_AGAIN, a new evaluation of the * body will happen (followed by another invocation of doAfterBody). * If doAfterBody returns SKIP_BODY, no more body evaluations will occur, * and the doEndTag method will be invoked. * *

* If this tag handler implements BodyTag and doAfterBody returns * SKIP_BODY, the value of out will be restored using the popBody * method in pageContext prior to invoking doEndTag. * *

* The method re-invocations may be lead to different actions because * there might have been some changes to shared state, or because * of external computation. * *

* The JSP container will resynchronize the values of any AT_BEGIN and * NESTED variables (defined by the associated TagExtraInfo or TLD) after * the invocation of doAfterBody(). * * @return whether additional evaluations of the body are desired * @throws JspException if an error occurred while processing this tag */ int doAfterBody() throws JspException; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy