My JSF page is like this, The <f:ajax>
part does now work.
<h:selectOneListbox value="#{category.categoryId}">
<f:selectItems value="#{category.allSubCategories}" var="c" itemLabel="#{c.title}" itemValue="#{c.categoryId}" />
<f:ajax execute="@form" render="projects" />
</h:selectOneListbox>
<h:panelGroup id="projects">
<ul>
<ui:repeat items="#{category.allItems}" var="o" id="itemTable">
<li><h:graphicImage value="#{o.imageUrl}" id="itemImage" /></li>
<li><h:outputText value="#{o.title}" /></li>
<li><label>Price: $ </label><h:outputText value="#{o.price}" /></li>
</ui:repeat>
</ul>
</h:panelGroup>
My bean is:
@ManagedBean(name = "category")
@SessionScoped
public class CategoryServiceBean extends BaseService implements Serializable {
private static final long serialVersionUID = -12082902292711980L;
private Integer categoryId;
private Integer parentCategoryId;
private Integer locationId;
@ManagedProperty(value="#{categorySupport}")
private CategorySupport categorySupport;
public List<RestCategory> getAllSubCategories() {
return getCategorySupport().getCategoriesByParent(locationId, parentCategoryId);
}
public List<RestItem> getAllItems() {
return response = getCategorySupport().getCategoryItems( locationId, categoryId);
}
// ...
}
My problem is that the <f:ajax execute="@form" render="projects" />
does not populate values to <h:panelGroup id="projects">
. How is this caused and how can I solve it? If I use <h:dataTable>
instead of <ui:repeat>
, then it works fine.
<ui:repeat items="#{category.allItems}" var="o" id="itemTable">
The items
attribute doesn't exist in <ui:repeat>
. You're apparently confusing it with <c:forEach>
. Use the value
attribute.
<ui:repeat value="#{category.allItems}" var="o" id="itemTable">