validatortag.java

来自「GridSphere 门户 提供一个基于 portlet 的高级开放源代码门户。」· Java 代码 · 共 51 行

JAVA
51
字号
package org.gridsphere.provider.portletui.tags;import org.gridsphere.provider.portletui.beans.ValidatorBean;import javax.servlet.jsp.JspException;import javax.servlet.jsp.tagext.Tag;/** * A <code>TextTag</code> represents text to be displayed */public class ValidatorTag extends BaseComponentTag {    protected ValidatorBean validatorBean = null;    protected String type = "";    /**     * Sets the validator type     *     * @param type the validator type     */    public void setType(String type) {        this.type = type;    }    /**     * Returns the validator type     *     * @return the validator type     */    public String getType() {        return type;    }    public int doStartTag() throws JspException {        Tag parent = this.getParent();        if (parent instanceof TextFieldTag) {            TextFieldTag textField = (TextFieldTag) parent;            if (key != null) value = this.getLocalizedText(key);            String tfClass = type;            textField.addCssClass(tfClass + "#");            ValidatorBean validatorBean = new ValidatorBean();            validatorBean.setValue(value);            validatorBean.setType(type);            textField.addValidatorBean(validatorBean);        }        super.release();        return SKIP_BODY;    }}

⌨️ 快捷键说明

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