It seems like I am simply unable to grasp, how updating components with Ajax works. I keep on getting an Exception "Cannot find component with identifier ":menu-item-container" referenced from "j_idt12:0:j_idt16:j_idt76"."
This is my code:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> <f:view contentType="text/html"> <h:head> <title><ui:insert name="pageTitle"></ui:insert></title> </h:head> <h:body> <h:outputStylesheet library="css" name="style.css" /> <div class="menu-navigation"> <ul> <li>Menu</li> <ui:repeat var="category" value="#{restaurantsBean.restaurant.categories}"> <h:form> <li><p:commandLink update=":menu-item-container"> <div> #{category.name} <f:setPropertyActionListener value="#{category.id}" target="# {restaurantMenuBean.selected}" /> </div> </p:commandLink></li> </h:form> </ui:repeat> </ul> </div> <div id="menu-item-container"> <ui:repeat var="category" value="#{restaurantsBean.restaurant.categories}"> <p:outputPanel> <h:panelGroup id="pangroup" layout="block" rendered="#{restaurantMenuBean.active(category.id)}"> <div class="some-heading"> <h2>#{category.name}</h2> </div> <div class="category-description">#{category.description}</div> <ui:repeat var="item" value="#{category.items}"> <p:outputPanel rendered="#{restaurantMenuBean.needLightbox(item)}"> <ui:include src="/lightbox-item.xhtml"></ui:include> </p:outputPanel> <p:outputPanel rendered="#{!restaurantMenuBean.needLightbox(item)}"> <ui:include src="/nolightbox-item.xhtml"></ui:include> </p:outputPanel> </ui:repeat> </h:panelGroup> </p:outputPanel> </ui:repeat> </div> </h:body> </f:view> </html> This is the related area of html source output, which tells me, my "menu-item-container" is right at the root and the update-attribute only needs a separation marker ":" in front of its id.
<div id="menu-item-container"><span id="j_idt17:0:j_idt64"></span><span id="j_idt17:1:j_idt64"><div id="j_idt17:1:pangroup"> <div class="some-heading">