0
我正在學習Primefaces 6.1,我想更新ui:repeat
組件。根據Alexandre's answer,我需要將ui:component
包裝在一個組件中,比如h:panelGroup
。然而,當我運行該項目,有一個錯誤說:找不到組件的表達式
不能爲組件「blogList」
任何人都知道,爲什麼要找的表達?以下是我的代碼的一部分。
<h:form>
<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5" >
<h:outputLabel value="Keyword: " for="keyword" />
<p:inputText id="keyword" class="searchbox" value="#{viewManagedBean.keyword}"></p:inputText>
<p:commandButton value="Search" actionListener="#{viewManagedBean.search(event)}" update="blogList"/>
</h:panelGrid>
<h:panelGroup id="blogList">
<ui:repeat value="#{viewManagedBean.guestBlogs}" var="blog">
<p:panel id="toggleable" header="#{blog.title}" footer="Created Date:#{blog.createdTime}" widgetVar="panel" style="margin-bottom:20px">
<h:outputText escape="false" value="#{blog.body}" style="font-weight: bold"/><hr />
</p:panel>
</ui:repeat>
</h:panelGroup>
</h:form>
嗨,請問每個問題1個問題...您是否嘗試了https://www.google.nl/search?q=cannot+find+expression+for+component+jsf提供的鏈接? – Kukeltje
'widgetVar =「panel」'不應該工作,如果'guestBlogs.size()> 1',因爲'widgetVar'必須是唯一的(每頁) –
@Kukeltje是的,我嘗試過:blogList,仍然不能。但是當我在下午再次嘗試時,它很有用。 –