本文整理匯總了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;
}
}
示例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));
}
}
示例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));
}
}
}
示例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));
}
}
示例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;
}
示例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;
}
示例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));
}
}
示例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);
}
示例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 "";
}
}