weixin_33711641 2012-09-19 09:14 采纳率: 0%
浏览 17

f:ajax无法更新ui:repeat

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.

  • 写回答

1条回答 默认 最新

  • 三生石@ 2012-09-19 13:26
    关注
    <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">
    
    评论

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示