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


Java UIInput.getValue方法代碼示例

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


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

示例1: calculateChecksum

import javax.faces.component.UIInput; //導入方法依賴的package包/類
/**
 * Calculate checksum.
 *
 * @param component
 *            the component
 * @return the long
 */
public static long calculateChecksum(final UIComponent component) {
	try {
		final Checksum checksumHandler = new CRC32();
		final UIFacesVisitor visitors = JKJsfUtil.visitComponent(component);
		final List<UIInput> inputs = visitors.getInputs();
		for (final UIInput uiInput : inputs) {
			if (uiInput.getValue() == null) {
				checksumHandler.update("null".getBytes(), 0, 0);
			} else {
				final byte[] bytes = uiInput.getValue().toString().getBytes("UTF-8");
				checksumHandler.update(bytes, 0, bytes.length);
			}
		}
		return checksumHandler.getValue();
	} catch (final Exception e) {
		JKExceptionUtil.handle(e);
		// unreachable
		return -1;
	}
}
 
開發者ID:kiswanij,項目名稱:jk-faces,代碼行數:28,代碼來源:JKJsfUtil.java

示例2: validate

import javax.faces.component.UIInput; //導入方法依賴的package包/類
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
	UIInput cpntPasswordLogin = (UIInput) component.getAttributes().get(PWD_FIELD);
	String userName = (String) cpntPasswordLogin.getValue();
	String password = (String) value;

	if (password == null || StringUtils.isEmpty(userName)) {
		throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, MISSING_INFORMATION, null));
	}

	String hash = this.userService.hashPassword(password);
	UserBO result = this.userService.findByName(userName);
	if (result == null || !result.getPassword().equals(hash)) {
		throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, INCORRECT_USER_LOGIN, null));
	}
}
 
開發者ID:dnbn,項目名稱:submerge,代碼行數:17,代碼來源:UserLoginValidator.java

示例3: validate

import javax.faces.component.UIInput; //導入方法依賴的package包/類
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
    UIInput passwordInput = (UIInput) component.getAttributes().get("password");
    UIInput newPasswordInput = (UIInput) component.getAttributes().get("newpassword");

    String confirm = (String) value;
    if (!(newPasswordInput != null && ((String) newPasswordInput.getValue()).length() == 0 && confirm.length() == 0)) {
        String password = null;
        if (passwordInput != null) {
            password = (String) passwordInput.getValue();
        } else if (newPasswordInput != null) {
            password = (String) newPasswordInput.getValue();
        }
        if (password == null || !password.equals(confirm)) {
            throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "The passwords doesn't match", null));
        }
    }
}
 
開發者ID:awph,項目名稱:jeef,代碼行數:19,代碼來源:SamePasswordValidator.java

示例4: validateMatch

import javax.faces.component.UIInput; //導入方法依賴的package包/類
/**
 *  Validate that field "confirm" matches to the field "password" 
 */
public void validateMatch(FacesContext context, UIComponent component, Object value)
      throws ValidatorException
{
    String confirm = (String)value;
    
    String field1Id = (String) component.getAttributes().get("passwd1Id");
    UIInput passComponent = (UIInput) context.getViewRoot().findComponent(field1Id);
    String pass = (String) passComponent.getSubmittedValue();
    if (pass == null)
    {
        pass = (String) passComponent.getValue();
    }
    
    if (!pass.equals(confirm))
    {
        String err = Application.getMessage(context, UsersDialog.ERROR_PASSWORD_MATCH);
        throw new ValidatorException(new FacesMessage(err));
    }
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:23,代碼來源:LoginBean.java

示例5: isFormulaGiven

import javax.faces.component.UIInput; //導入方法依賴的package包/類
private boolean isFormulaGiven(FacesContext context) {
	UIInput inputFormulaField = (UIInput) context.getViewRoot().findComponent("mainForm:inputFormula");
	if (inputFormulaField == null) {
		return false; 
	}
	String inputFormula = (String) inputFormulaField.getValue();
	
	if(inputFormula != null && inputFormula.trim().length() == 0) {
		return false;
	}
	return true;
}
 
開發者ID:c-ruttkies,項目名稱:MetFragRelaunched,代碼行數:13,代碼來源:SearchPPMValidator.java

示例6: isIdentifierGiven

import javax.faces.component.UIInput; //導入方法依賴的package包/類
private boolean isIdentifierGiven(FacesContext context) {
	UIInput inputIdentifiersField = (UIInput) context.getViewRoot().findComponent("mainForm:inputIdentifiers");
	if (inputIdentifiersField == null) {
		return false; 
	}
	String inputIdentifiers = (String) inputIdentifiersField.getValue();
	
	if(inputIdentifiers != null && inputIdentifiers.trim().length() == 0) {
		return false;
	}
	return true;
}
 
開發者ID:c-ruttkies,項目名稱:MetFragRelaunched,代碼行數:13,代碼來源:SearchPPMValidator.java

示例7: validate

import javax.faces.component.UIInput; //導入方法依賴的package包/類
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
	
	UIInput cpntPassword = (UIInput) component.getAttributes().get(PWD_FIELD);
	String password = (String) cpntPassword.getValue();
	String confirm = (String) value;

	if (confirm != null && !confirm.equals(password)) {
		throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, PWD_ARE_DIFFERENTS, null));
	}

}
 
開發者ID:dnbn,項目名稱:submerge,代碼行數:13,代碼來源:ConfirmPasswordValidator.java

示例8: computeValueAsISOString

import javax.faces.component.UIInput; //導入方法依賴的package包/類
private String computeValueAsISOString(FacesContext context, UIInput input) {
    DateTimeConverter converter = (DateTimeConverter) input.getConverter();
    
    // the submitted value takes precedence
    // As it is a string, no conversion should happen 
    Object submittedValue = input.getSubmittedValue();
    if (submittedValue != null) {
        return (String)submittedValue;
    }
    Object value = input.getValue();
    if( null == value ){
        return "";
    }
    return getAsString(context, input, converter, value);
}
 
開發者ID:OpenNTF,項目名稱:XPagesExtensionLibrary,代碼行數:16,代碼來源:InputDateRenderer.java

示例9: getInputValue

import javax.faces.component.UIInput; //導入方法依賴的package包/類
/**
 * Returns the String value for a Faces UIInput component.
 * <p/>
 * If the associated value is null or not a String, 
 * an empty String is returned.
 * @param input the Faces input component whose value will be returned
 */
protected String getInputValue(UIInput input) {
  Object oValue = input.getValue();
  if ((oValue != null) && (oValue instanceof String)) {
    return (String)oValue;
  } else {
    return "";
  }
}
 
開發者ID:GeoinformationSystems,項目名稱:GeoprocessingAppstore,代碼行數:16,代碼來源:Input.java


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