Primefaces Outputpanel deferred = true

时间:2015-04-26 04:33:13

标签: jsf primefaces

<h:form id="linkpanel">
<p:commandLink id="TestPanle" value="Test" update="contentOutputPanelId"/>
</h:form>
...
<h:form id="reRenderForm">
 <p:outputPanel id="contentOutputPanelId" deferred="true"  style="padding:5px;">
  <ui:include src="/pages/test.xhtml"/>
</p:outputPanel>
<h:form>

当我按下commandLink按钮时,它将更新并且contentOutputPanelId并包含test.xhtml。我怀疑是没有deferred =“true”它不会包含页面当我按下刷新页面它工作正常。否则givent deferred =“true”它工作正常。

1 个答案:

答案 0 :(得分:2)

你的怀疑是合理的:

p:outputpanel标记处理程序,而UIComponentui:include。标记处理程序在视图构建时进行评估和解析,即在设置视图的组件树时(基本上,确定页面中 的实际内容) )。另一方面,该组件在 view-render 进行评估,这主要与标记解释有关

这对您来说意味着,在评估p:outputPanel时,var q = new BatchQueue("localhost", batchname); //Receive message 1 or 2 var res = q.Receive(); while (res != null) { //Infinite loop System.Diagnostics.Trace.WriteLine(res.Files[0]); q.Confirm(); Interlocked.Increment(ref counter); } 不在图片中,因此无法影响其处理。包含将发生。

Taghandlers仅在新页面加载时进行评估,而不是在回发时进行评估,因此在那时它不再重要