1
複数の検証を形成primefacesは、私は時間内に複数のコンポーネントを検証するために問題を抱えている
ここ<p:inputText id="actionNameInput"
title="TO DO"
value="#{repositoryBean.newActionName}"
label="Action name"
required="true"
requiredMessage="Action name is missing.">
<f:validator validatorId="inputTextValidator"/>
<f:attribute name="input1" value="Action name" />
</p:inputText>
<p:inputText id="identifierInput"
title="TO DO"
value="#{repositoryBean.newActionRegex}"
label="Identifier"
required="true"
requiredMessage="Identifier is missing.">
<f:validator validatorId="inputTextValidator"/>
<f:attribute name="input1" value="Identifier" />
</p:inputText>
は、バリデータクラスがあります:
@FacesValidator(value = "inputTextValidator")
public class AddActionValidatorInputText implements Validator{
@Override
public void validate(FacesContext facesContext, UIComponent uiComponent, Object o) throws ValidatorException {
if(((String)o).length() < 3){
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
uiComponent.getAttributes().get("input1")+" should be longer than 3characters.", null);
FacesContext.getCurrentInstance().addMessage(null, message);
throw new ValidatorException(message);
}
}
}
それだけで...私はthisをtryiedている最初のinputTextを検証しますが、私はコンポーネント(常にnull)から値を取得するカント...、私はシームの顔についてsmthing読み取り、私はそれを適用した場合いくつかの大きなエラーがありました(それにはますます依存が必要です...)。私は自分のbeanクラスでそれを検証したくありません。
'h:inputText'で動作しますか? – Kukeltje