【发布时间】:2016-07-29 16:13:59
【问题描述】:
我尝试在单击按钮时更新页面的一部分。 现在,我有以下内容:
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"/>
然后内容被更新但页面被刷新。有什么想法我在这里做错了吗?
【问题讨论】:
-
页面刷新是什么意思?重新加载?还是你放宽了范围?
-
停止使用
prependId="false",永远不要使用它,它是 JSF 1.2 的一个不经思考的遗留物。
标签: jsf jsf-2 primefaces commandbutton ajax-upload