I have to select one menus. In the first select one menu i load all warehouse values.
In the second one menu i want to load all products, which depends to the warehouse. So if i do a value Change of the first select one menu i am going to render the second one menu.
I have a ProductDataAction Bean. In this bean i have following method.
public List<Product> getAllProductsForProjectAndWarehouse() {
Warehouseinput w = warehouseinputDataAction.getActualWarehouseInput();
return w.getWarehouse().getProduct();
}
My Problem is, that the value w.getWarehouse() is null in my ProductDataActionBean.
My Expectation is, that it is not null, because in my xthml page i set the warehouseinputSaveActions.actualWarehouseInput.warehouse in the value of the first select one menu.
<div class="form-group form-md-line-input">
<label class="col-md-2 control-label">#{texts['warehouseinput.warehouse']}</label>
<h:selectOneMenu value="#{warehouseinputSaveActions.actualWarehouseInput.warehouse}">
<f:converter converterId="ccWarehouseConverter"/>
<f:selectItems value="#{warehouseDataActions.getAllWarehousesForProject
(warehouseinputDataActions.actualWarehouseInput.project)}" var="warehouse"
itemLabel="#{warehouse.warehouseName}" itemValue="#{warehouse}"/>
<f:ajax event="change" execute="@form" render="products"/>
</h:selectOneMenu>
</div>
<div class="form-group form-md-line-input">
<label class="col-md-2 control-label">#{texts['warehouseinput.product']}</label>
<h:selectOneMenu id="products" value="#{warehouseinputSaveActions.actualWarehouseInput.product}">
<f:converter converterId="ccConverter"/>
<f:selectItems value="#{productDataActions.getAllProductsForProjectAndWarehouse()}"
var="product"itemLabel="#{product.productName}" itemValue="#{product}"/>
</h:selectOneMenu>
</div>