valuetagextrainfo.java

来自「大家好啊 快来抢购J2ME东东 挺不错的啊 不要后悔啊 抓住机会」· Java 代码 · 共 55 行

JAVA
55
字号
package com.ora.jsp.tags.sql.value;

import javax.servlet.jsp.tagext.*;

/**
 * This class provides additional attribute validation code for
 * ValueTag subclasses.
 *
 * @author Hans Bergsten, Gefion software <hans@gefionsoftware.com>
 * @version 1.0
 */
public class ValueTagExtraInfo extends TagExtraInfo {
    /**
     * Returns true only if a valid combination of attributes
     * is specified:
     * <pre>
     *   value                   |
     *   stringValue [ pattern ] |
     *   param [ pattern ]       |
     *   name property [ pattern ]
     * </pre>
     */
    public boolean isValid(TagData data) {
        boolean isValid = false;
        Object value = data.getAttribute("value");
        Object stringValue = data.getAttribute("stringValue");
        Object pattern = data.getAttribute("pattern");
        Object param = data.getAttribute("param");
        Object name = data.getAttribute("name");
        Object property = data.getAttribute("property");
        
        if (value != null && 
            (stringValue == null && param == null && pattern == null &&
            name == null && property == null)) {
            isValid = true;
        }
        else if (stringValue != null &&
            (value == null && param == null && name == null &&
            property == null)) {
            isValid = true;
        }
        else if (param != null &&
            (value == null && stringValue == null && name == null &&
            property == null)) {
            isValid = true;
        }
        else if (name != null &&
            (value == null && stringValue == null && param == null &&
            property != null)) {
            isValid = true;
        }
        return isValid;
    }
}

⌨️ 快捷键说明

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