<h:dataTable value="#{products.getAllProducts()}"
var="product">
....
<h:column rendered="...">
<f:facet name="header">Quantity</f:facet>
<h:inputText id="basket-qty" value="#{basket.qty}" rendered="#{product.stock.qty > 0}" >
<f:convertNumber integerOnly="true" />
<f:validateLongRange minimum="1" maximum="#{product.stock.qty}" />
</h:inputText>
<h:message id="textmessage" for="basket-qty" />
</h:column>
<h:column rendered="...">
<h:commandButton action="#{basket.addProduct(product)}"
value ="Add to Basket">
</h:commandButton>
</h:column>
</h:dataTable>
基本上问题是maximum="#{product.stock.qty}"
评估为零,因此我的范围是0-0?
product.stock.qty在表中的其他位置正确评估。