My JSF managed bean is not constructed when I hit the page.
This is my facelet:
<h:dataTable value="#{productsBean.producten}" var="product">
<h:column>#{product.description}</h:column>
<h:column>#{product.price}</h:column>
<h:column>#{product.categoryName}</h:column>
<h:column>
<h:link value="Edit" outcome="/products/edit">
<f:param name="id" value="#{product.product_id}"/>
</h:link>
</h:column>
</h:dataTable>
This is my ProductsBean:
@ManagedBean(eager=true)
@RequestScoped
public class ProductsBean implements Serializable{
private List<ProductBean> producten; //+getter
@ManagedProperty(value = "#{applicationBean}")
private ApplicationBean applicationBean;
public ProductsBean() {
Store store = applicationBean.getStore();
for (String c : store.getCategories()) {
for(be.kdg.shop.model.stock.Product p : store.getProductsOfCategory(c)){
ProductBean product = new ProductBean();
product.setProduct_id(p.getProduct_id());
product.setDescription(p.getDescription());
product.setCategoryName(p.getCategoryName());
product.setPrice(p.getPrice());
producten.add(product);
}
}
....
When I use "#{productsBean.producten}" my JavaBean should my initialized but it doesn't. When I debug my code i doesn't reach the constructor.