當前位置: 首頁>>代碼示例>>Java>>正文


Java UIInput.getLocalValue方法代碼示例

本文整理匯總了Java中javax.faces.component.UIInput.getLocalValue方法的典型用法代碼示例。如果您正苦於以下問題:Java UIInput.getLocalValue方法的具體用法?Java UIInput.getLocalValue怎麽用?Java UIInput.getLocalValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.faces.component.UIInput的用法示例。


在下文中一共展示了UIInput.getLocalValue方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: validate

import javax.faces.component.UIInput; //導入方法依賴的package包/類
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
    UIInput positionUI = (UIInput)component.findComponent("position");
    UIInput userTypeUI = (UIInput)component.findComponent("userType");
    String position = (String)positionUI.getLocalValue();
    UserType userType = (UserType)userTypeUI.getLocalValue();
    String inputValue = (String)value;
    if(position.equals("student") && userType == UserType.ADVANCE){
        if(inputValue == null || inputValue.trim().length()==0){
            FacesMessage message = new FacesMessage(
                    ResourceBundle.getBundle("ValidationMessages",context.getViewRoot().getLocale())
                            .getString("cn.edu.pku.lib.dataverse.validation.AdvanceBuiltinUserSupervisorValidation.message"));
            message.setSeverity(FacesMessage.SEVERITY_ERROR);
            throw new ValidatorException(message);
        }
    }
}
 
開發者ID:pengchengluo,項目名稱:Peking-University-Open-Research-Data-Platform,代碼行數:18,代碼來源:AdvanceBuiltinUserSupervisorValidation.java

示例2: correctPasswordEntered

import javax.faces.component.UIInput; //導入方法依賴的package包/類
/**
 * Make sure the correct password was entered
 * @param components the component to check
 * @return true is correct, false otherwise
 */
private boolean correctPasswordEntered(UIComponent components) {
    UIInput uiInputVerifyPassword = (UIInput) components.findComponent("verifyPassword");
    String verifyPassword = uiInputVerifyPassword.getLocalValue() == null ? ""
            : uiInputVerifyPassword.getLocalValue().toString();
    if (verifyPassword.isEmpty()) {
        statusMessage = "";
        return false;
    } else {
        if (verifyPassword.equals(password)) {
            return true;
        } else {
            statusMessage = "Invalid password entered!";
            return false;
        }
    }
}
 
開發者ID:McBrosa,項目名稱:MapChat,代碼行數:22,代碼來源:AccountManager.java

示例3: validate

import javax.faces.component.UIInput; //導入方法依賴的package包/類
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
    UIInput userTypeUI = (UIInput)component.findComponent("userType");
    UserType userType = (UserType)userTypeUI.getLocalValue();
    String inputValue = (String)value;
    if(userType == null || userType == UserType.ADVANCE){ //userType == null為編輯模式下,用戶類型為高級
        if(inputValue == null || inputValue.trim().length()==0){
            FacesMessage message = new FacesMessage(
                    ResourceBundle.getBundle("ValidationMessages",context.getViewRoot().getLocale())
                            .getString("org.hibernate.validator.constraints.NotBlank.message"));
            message.setSeverity(FacesMessage.SEVERITY_ERROR);
            throw new ValidatorException(message);
        }
    }
}
 
開發者ID:pengchengluo,項目名稱:Peking-University-Open-Research-Data-Platform,代碼行數:16,代碼來源:AdvanceBuiltinUserNotBlankValidator.java

示例4: validate

import javax.faces.component.UIInput; //導入方法依賴的package包/類
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
    UIInput userTypeUI = (UIInput)component.findComponent("userTypeIAAA");
    UserType userType = (UserType)userTypeUI.getLocalValue();
    String inputValue = (String)value;
    if(userType == null || userType == UserType.ADVANCE){ //userType == null為編輯模式下,用戶類型為高級
        if(inputValue == null || inputValue.trim().length()==0){
            FacesMessage message = new FacesMessage(
                    ResourceBundle.getBundle("ValidationMessages",context.getViewRoot().getLocale())
                            .getString("org.hibernate.validator.constraints.NotBlank.message"));
            message.setSeverity(FacesMessage.SEVERITY_ERROR);
            throw new ValidatorException(message);
        }
    }
}
 
開發者ID:pengchengluo,項目名稱:Peking-University-Open-Research-Data-Platform,代碼行數:16,代碼來源:AdvancePkuIAAAUserNotBlankValidator.java

示例5: validateInformation

import javax.faces.component.UIInput; //導入方法依賴的package包/類
/**
 * Validate the password
 * @param event 
 */
public void validateInformation(ComponentSystemEvent event) {
    FacesContext fc = FacesContext.getCurrentInstance();

    UIComponent components = event.getComponent();
    // get password
    UIInput uiInputPassword = (UIInput) components.findComponent("password");
    String pwd = uiInputPassword.getLocalValue() == null ? ""
            : uiInputPassword.getLocalValue().toString();

    // get confirm password
    UIInput uiInputConfirmPassword = (UIInput) components.findComponent("confirmPassword");
    String confirmPassword = uiInputConfirmPassword.getLocalValue() == null ? ""
            : uiInputConfirmPassword.getLocalValue().toString();

    if (pwd.isEmpty() || confirmPassword.isEmpty()) {
        // Do not take any action. 
        // The required="true" in the XHTML file will catch this and produce an error message.
        return;
    }

    if (!pwd.equals(confirmPassword)) {
        message = "Passwords must match!";
    } else {
        message = "";
    }   
}
 
開發者ID:McBrosa,項目名稱:MapChat,代碼行數:31,代碼來源:PasswordResetManager.java

示例6: validateInformation

import javax.faces.component.UIInput; //導入方法依賴的package包/類
/**
 * Make sure the two password are equal when the event is received
 * @param event the event to listen for
 */
public void validateInformation(ComponentSystemEvent event) {
    FacesContext fc = FacesContext.getCurrentInstance();

    UIComponent components = event.getComponent();
    // Get password
    UIInput uiInputPassword = (UIInput) components.findComponent("password");
    String pwd = uiInputPassword.getLocalValue() == null ? ""
            : uiInputPassword.getLocalValue().toString();

    // Get confirm password
    UIInput uiInputConfirmPassword = (UIInput) components.findComponent("confirmPassword");
    String confirmPassword = uiInputConfirmPassword.getLocalValue() == null ? ""
            : uiInputConfirmPassword.getLocalValue().toString();

    if (pwd.isEmpty() || confirmPassword.isEmpty()) {
        // Do not take any action. 
        // The required="true" in the XHTML file will catch this and produce an error message.
        return;
    }

    if (!pwd.equals(confirmPassword)) {
        statusMessage = "Passwords must match!";
    } else {
        statusMessage = "";
    }   
}
 
開發者ID:McBrosa,項目名稱:MapChat,代碼行數:31,代碼來源:AccountManager.java

示例7: validatePassword

import javax.faces.component.UIInput; //導入方法依賴的package包/類
public void validatePassword(ComponentSystemEvent event) {
    FacesContext fc = FacesContext.getCurrentInstance();

    UIComponent components = event.getComponent();

    // get password
    UIInput uiInputPassword = (UIInput) components.findComponent("newPassword");
    String password = uiInputPassword.getLocalValue() == null ? ""
            : uiInputPassword.getLocalValue().toString();
    String passwordId = uiInputPassword.getClientId();

    // get confirm password
    UIInput uiInputConfirmPassword = (UIInput) components.findComponent("newConfirmPassword");
    String confirmPassword = uiInputConfirmPassword.getLocalValue() == null ? ""
            : uiInputConfirmPassword.getLocalValue().toString();

    // Let required="true" do its job.
    if (password.isEmpty() || confirmPassword.isEmpty()) {
        return;
    }

    if (!password.equals(confirmPassword)) {
        FacesMessage msg = new FacesMessage(bundle.getString("resetpassword.error.notmatch"));
        msg.setSeverity(FacesMessage.SEVERITY_ERROR);
        fc.addMessage(passwordId, msg);
        fc.renderResponse();
    }
}
 
開發者ID:SECQME,項目名稱:watchoverme-server,代碼行數:29,代碼來源:ResetPasswordBean.java


注:本文中的javax.faces.component.UIInput.getLocalValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。