flushbuffertag.java

来自「jakarta-taglibs」· Java 代码 · 共 60 行

JAVA
60
字号
/*
 * Copyright 1999,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 org.apache.taglibs.response;

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;

/**
 * JSP Tag <b>flushBuffer</b>, used to flush the output buffer to the client.
 * <p>
 * JSP Tag Lib Descriptor
 * <p><pre>
 * &lt;name&gt;flushBuffer&lt;/name&gt;
 * &lt;tagclass&gt;org.apache.taglibs.response.FlushBufferTag&lt;/tagclass&gt;
 * &lt;bodycontent&gt;empty&lt;/bodycontent&gt;
 * &lt;info&gt;Forces any content in the buffer to be written to the client.&lt;/info&gt;
 * </pre>
 *
 * @author Glenn Nielsen
 */

public class FlushBufferTag extends TagSupport
{

    /**
     * Method called at end of Tag, forces flush of output buffer to client.
     *
     * @return EVAL_PAGE
     */ 
    public final int doEndTag() throws JspException
    {
	try {
	    pageContext.getResponse().flushBuffer();
	} catch(IOException e) {
	    throw new JspException("Response flushBuffer tag failed: " +
		e.getMessage());
	}
	return EVAL_PAGE;
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?