当前位置: 首页>>代码示例>>Java>>正文


Java HtmlInputText.getLabel方法代码示例

本文整理汇总了Java中javax.faces.component.html.HtmlInputText.getLabel方法的典型用法代码示例。如果您正苦于以下问题:Java HtmlInputText.getLabel方法的具体用法?Java HtmlInputText.getLabel怎么用?Java HtmlInputText.getLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.faces.component.html.HtmlInputText的用法示例。


在下文中一共展示了HtmlInputText.getLabel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validate

import javax.faces.component.html.HtmlInputText; //导入方法依赖的package包/类
@Override
public void validate(FacesContext context, UIComponent uiComponent, Object value) throws ValidatorException {
    Pattern pattern = Pattern.compile("\\[email protected]\\w+\\.\\w+");
    Matcher matcher = pattern.matcher(
            (CharSequence) value);
    HtmlInputText htmlInputText
            = (HtmlInputText) uiComponent;
    String label;

    if (htmlInputText.getLabel() == null
            || htmlInputText.getLabel().trim().equals("")) {
        label = htmlInputText.getId();
    } else {
        label = htmlInputText.getLabel();
    }

    if (!matcher.matches()) {
        FacesMessage facesMessage
                = new FacesMessage(label
                        + ": not a valid email address");

        throw new ValidatorException(facesMessage);
    }
}
 
开发者ID:PacktPublishing,项目名称:Java-EE-7-Development-with-NetBeans-8,代码行数:25,代码来源:EmailValidator.java

示例2: validateAlphaSpace

import javax.faces.component.html.HtmlInputText; //导入方法依赖的package包/类
/**
 * Validates that the passed field only contains alphabetic characters and spaces
 * @param context
 * @param component
 * @param value
 * @throws ValidatorException 
 */
public void validateAlphaSpace(FacesContext context, UIComponent component, Object value) throws ValidatorException {
    String valueString = (String) value;
    if (!valueString.matches("[a-zA-Z ]+")) {
        HtmlInputText htmlInputText = (HtmlInputText) component;
        FacesMessage facesMessage = new FacesMessage(htmlInputText.getLabel() + ": only alphabetic and space characters are allowed.");
        throw new ValidatorException(facesMessage);
    }
}
 
开发者ID:CCSU-CS416F16,项目名称:CS416F16CourseInfo,代码行数:16,代码来源:ValidationUtils.java

示例3: validateState

import javax.faces.component.html.HtmlInputText; //导入方法依赖的package包/类
public void validateState(FacesContext context, UIComponent component, Object value) throws ValidatorException {
    String valueString = (String) value;
    if (!states.contains(valueString)) {
        HtmlInputText htmlInputText = (HtmlInputText) component;
        FacesMessage facesMessage = new FacesMessage(htmlInputText.getLabel() + ": Not state abbreviation");
        throw new ValidatorException(facesMessage);

    }
}
 
开发者ID:CCSU-CS416F16,项目名称:CS416F16CourseInfo,代码行数:10,代码来源:ValidationUtils.java

示例4: validateZipCode

import javax.faces.component.html.HtmlInputText; //导入方法依赖的package包/类
public void validateZipCode(FacesContext context, UIComponent component, Object value) throws ValidatorException {
    String valueString = (String) value;
    if (!zipCodes.contains(valueString)) {
        HtmlInputText htmlInputText = (HtmlInputText) component;
        FacesMessage facesMessage = new FacesMessage(htmlInputText.getLabel() + ": Not one of the allowed zip codes");
        throw new ValidatorException(facesMessage);

    }
}
 
开发者ID:CCSU-CS416F16,项目名称:CS416F16CourseInfo,代码行数:10,代码来源:ValidationUtilsSoln.java

示例5: validate

import javax.faces.component.html.HtmlInputText; //导入方法依赖的package包/类
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
    String emailAddress = (String)value;
    HtmlInputText htmlInputText = (HtmlInputText)component;
    if (!emailAddress.matches("[A-Za-z0-9][email protected][A-Za-z0-9]+.[A-Za-z0-9]+")){
        FacesMessage facesMessage =  new FacesMessage(htmlInputText.getLabel()+": email format is not valid");
        throw new ValidatorException(facesMessage);
    }
}
 
开发者ID:CCSU-CS416F16,项目名称:CS416F16CourseInfo,代码行数:10,代码来源:EmailValidator.java


注:本文中的javax.faces.component.html.HtmlInputText.getLabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。