我的 JSF 页面是这样的,该<f:ajax>
部分现在可以工作了。
<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>
我的豆是:
@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);
}
// ...
}
我的问题是<f:ajax execute="@form" render="projects" />
不会将值填充到<h:panelGroup id="projects">
. 这是如何引起的,我该如何解决?如果我使用<h:dataTable>
而不是<ui:repeat>
,那么它工作正常。