我嘗試更新按鈕單擊頁面的一部分。 現在,我有以下幾點:p:commandButton刷新整個頁面,而不是部分,而f:ajax正常工作
的template.xhtml
<h:form prependId="false">
<h:commandButton value="NEWS" action="news">
<f:ajax render="newsContent"></f:ajax>
</h:commandButton>
<h:panelGroup layout="block" id="newsContent">
<ui:insert name="newsContent">
<ui:include src="/WEB-INF/partials/news/news.xhtml"/>
</ui:insert>
</h:panelGroup>
</h:form>
/WEB-INF/partials/news/news.xhtml
<h:commandLink action="newsdetails">
<f:ajax render="newsContent" />
</h:commandLlink>
newsdetails.xhtml
<h:commandButton value="INDEX" action="index">
<f:ajax render="newsContent" />
</h:commandButton>
現在它工作正常,但如果我的東西替換<h:commandbutton>
像
<p:commandButton value="INDEX" action="index" update="newsContent"/>
那麼,內容已經更新,但頁面刷新。有什麼想法我在這裏做錯了嗎?
你對頁面的意思是什麼意思?重裝上陣?或者你是否放棄了範圍? – tak3shi
停止使用'prependId =「false」',只是從不使用它,這是JSF 1.2中的一個不良後果。 – BalusC