I have a JSF validator that checks whether a Container Number string conforms to the ISO-6346 specficiation.
It works fine, however I need to add some conditional p
Using the <f:attribute>
you can pass a Bean to the validator and retrieve it from the component as a value expression.
So my input is like this (must be using
and not the validator attribute on the
) :
And my validator class:
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
String containerNumber = (String)value;
Object containerBean = component.getValueExpression("containerBean").getValue(context.getELContext());
if(containerBean instanceof BeanA) {
//do this
}