⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ifcontainerlistsizetag.java

📁 java 写的一个新闻发布系统
💻 JAVA
字号:
package org.jahia.taglibs.container;import org.jahia.data.containers.JahiaContainerList;import org.jahia.exceptions.JahiaException;import org.jahia.taglibs.util.Utils;import org.jahia.taglibs.container.ContainerListTag;import org.jahia.utils.JahiaConsole;import java.io.*;import java.util.*;import javax.servlet.*;import javax.servlet.jsp.*;import javax.servlet.jsp.tagext.*;/** * Class IfContainerListSizeTag : this tag evaluates its body only when the size of *                the enclosing container list passes the comparison test using the *                given operator and value * * @author  Jerome Tamiotti */public class IfContainerListSizeTag extends BodyTagSupport {    private String op;    private int value;    public void setOp(String op) {        this.op = op;    }    public void setValue(int value) {        this.value = value;    }    public int doAfterBody() {        // gets the enclosing tag ContainerListTag        ContainerListTag containerListTag = (ContainerListTag) findAncestorWithClass(this, ContainerListTag.class);        if (containerListTag == null) {            JahiaConsole.println("IfContainerListSize: doAfterBody", "No container list tag found !!");            return SKIP_BODY;        }        if (containerListTag.isDeclarationPass()) {            return SKIP_BODY;        }        JahiaContainerList containerList = containerListTag.getContainerList();        if (containerList == null) {            JahiaConsole.println("IfContainerListSize: doAfterBody", "NULL container list in tag !!");            return SKIP_BODY;        }        Enumeration containers = containerList.getContainers();        if ( Utils.compare( Utils.enumSize(containers), op, value ) ) {            // the current container is the first of the stack            try {                BodyContent body = getBodyContent();                JspWriter out = body.getEnclosingWriter();                out.print(body.getString());            } catch (IOException ioe) {                JahiaConsole.println("IfFirstContainerTag: doAfterBody ",ioe.toString());            }        }        return SKIP_BODY;    }}

⌨️ 快捷键说明

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