Jsf <;f:属性名称=“属性名称”;id"&燃气轮机;在javax.faces.component.UIComponent.setValueExpression处抛出java.lang.IllegalArgumentException
我有一个选择一个菜单和一个VALDATA,如下所示:Jsf <;f:属性名称=“属性名称”;id"&燃气轮机;在javax.faces.component.UIComponent.setValueExpression处抛出java.lang.IllegalArgumentException,jsf,attributes,illegalargumentexception,Jsf,Attributes,Illegalargumentexception,我有一个选择一个菜单和一个VALDATA,如下所示: <h:selectOneMenu value="#{planning.formuleCremation}" converter="#{formuleCremationConverter}" validator="#{PlanningSalleAppareilFormuleCremationValidator}"> <f:selectItems value="#{beanPlanningSalleAp
<h:selectOneMenu value="#{planning.formuleCremation}"
converter="#{formuleCremationConverter}"
validator="#{PlanningSalleAppareilFormuleCremationValidator}">
<f:selectItems value="#{beanPlanningSalleAppareil.formules}"
var="formule"
itemLabel="#{formule.alias}"
itemValue="#{formule}" />
<f:attribute name="id" value="#{planning.id}" />
</h:selectOneMenu>
public void validate(FacesContext fc, UIComponent uic, Object o) throws ValidatorException {
//Retrieve the attribute id passed with the current component
int id = (int) uic.getAttributes().get("id");
Object selectedObject = null;
//Current Planning
PlanningSalleAppareil planningSalleAppareil = planningSalleAppareilService.trouver(id);
if(planningSalleAppareil.getAppareil() != null)
selectedObject = planningSalleAppareil.getAppareil();
if(planningSalleAppareil.getSalle() != null)
selectedObject = planningSalleAppareil.getSalle();
planningSalleAppareil.setFormuleCremation((FormuleCremation) o);
if(selectedObject != null){
String errorMessage = planningSalleAppareilService.validPlanningSalleAppareil(planningSalleAppareil,selectedObject);
if(!errorMessage.equals("1")){
FacesMessage msg = new FacesMessage(errorMessage);
msg.setSeverity(FacesMessage.SEVERITY_ERROR);
throw new ValidatorException(msg);
}
}
}
但这不起作用,它会抛出我:javax.faces.component.UIComponent.setValueExpression的java.lang.IllegalArgumentException
当我只将:
添加到SelectOne菜单时,就会出现此错误,否则验证程序会工作
我如何才能有效地解决这个问题
<h:selectOneMenu ...>
<f:attribute name="id" value="#{planning.id}" />
...
</h:selectOneMenu>
实际上
<h:selectOneMenu ...>
<f:attribute name="id" value="#{planning.id}" />
...
</h:selectOneMenu>
在那之后,我的验证器出现了问题:在那之后,我的验证器出现了问题:
<f:attribute name="planningId" ... />