Bhesh is entirely right. You should be doing the validating job inside a Validator
.
As to the concrete problem, move the <f:attribute>
out of the <f:converter>
(or <f:validator>
if you're listening to us) into the input component and then use UIComponent#getAttributes()
to obtain it. E.g.
<h:inputText ...>
<f:validator validatorId="valueValidator" />
<f:attribute name="theMaxOrderSize" id="maxorder" value="#{_cartItem.item.maxOrderSize}"/>
</h:inputText>
with
Object theMaxOrderSize = component.getAttributes().get("theMaxOrderSize");
// ...
(where component
is the UIComponent
argument of the validate()
method, it represents the parent input component)
You can cast it to Integer
or whatever object type the #{_cartItem.item.maxOrderSize}
represents.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…