Jsf 2 ValueExpression:如何获取基本对象?
ValueReference始终为空Jsf 2 ValueExpression:如何获取基本对象?,jsf-2,el,Jsf 2,El,ValueReference始终为空 怎么了?谢谢您的验证: @FacesValidator("uniqueValidator") public class UniqueValidator implements Validator { @Override public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
怎么了?谢谢您的验证:
@FacesValidator("uniqueValidator")
public class UniqueValidator implements Validator
{
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
{
if(context == null)
{
throw new NullPointerException();
}
if(component == null)
{
throw new NullPointerException();
}
ValueExpression valueExpression = component.getValueExpression("value");
if(valueExpression == null)
{
return;
}
ValueReference valueReference = valueExpression.getValueReference(context.getELContext());
if(valueReference == null)
{
return;
}
Object base = valueReference.getBase();
Object property = valueReference.getProperty();
Tracer.out(base, property);
.....
}
}
谢谢你,BeanValidator:
@FacesValidator("uniqueValidator")
public class UniqueValidator implements Validator
{
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
{
if(context == null)
{
throw new NullPointerException();
}
if(component == null)
{
throw new NullPointerException();
}
ValueExpression valueExpression = component.getValueExpression("value");
if(valueExpression == null)
{
return;
}
ValueReference valueReference = valueExpression.getValueReference(context.getELContext());
if(valueReference == null)
{
return;
}
Object base = valueReference.getBase();
Object property = valueReference.getProperty();
Tracer.out(base, property);
.....
}
}
查看Omnifaces ExpressionSpector。在JSF2.x中,它似乎没有实现,并且总是返回null
查看Omnifaces ExpressionSpector。在JSF2.x中,它似乎没有实现,并且总是返回null
美好的但无法设置属性值:?!美好的但无法设置属性值:?!你注意到这个问题是8年前的事了吗?您是否注意到Omnifaces ExpressionSpector与BeanValidator的实现完全相同?您是否注意到这个问题是8年前提出的?您是否注意到Omnifaces ExpressionSpector与BeanValidator是完全相同的实现?