blockextractingrule.java

来自「OS(OpenSymphony)的SiteMesh是一个用来在JSP中实现页面布」· Java 代码 · 共 50 行

JAVA
50
字号
package com.opensymphony.module.sitemesh.html;import com.opensymphony.module.sitemesh.html.util.CharArray;public abstract class BlockExtractingRule extends BasicRule {    private boolean includeEnclosingTags;    // we should only handle tags that have been opened previously.    // else the parser throws a NoSuchElementException (SIM-216)    private boolean seenOpeningTag;    protected BlockExtractingRule(boolean includeEnclosingTags, String acceptableTagName) {        super(acceptableTagName);        this.includeEnclosingTags = includeEnclosingTags;    }    protected BlockExtractingRule(boolean includeEnclosingTags) {        this.includeEnclosingTags = includeEnclosingTags;    }    public void process(Tag tag) {        if (tag.getType() == Tag.OPEN) {            if (includeEnclosingTags) {                tag.writeTo(context.currentBuffer());            }            context.pushBuffer(createBuffer());            start(tag);            seenOpeningTag = true;        } else if (tag.getType() == Tag.CLOSE && seenOpeningTag) {            end(tag);            context.popBuffer();            if (includeEnclosingTags) {                tag.writeTo(context.currentBuffer());            }        }    }    protected void start(Tag tag) {    }    protected void end(Tag tag) {    }    protected CharArray createBuffer() {        return new CharArray(512);    }}

⌨️ 快捷键说明

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