p:dataTable中输入文本的ajax调用需要很长时间才能呈现响应

时间:2018-09-26 07:06:29

标签: jsf primefaces

我的应用程序中有一个复杂的页面。我正在使用JSF 2.0 PrimeFaces 5.0。
从后端,我将在1-3秒内获得相应呼叫的响应,但是要在xhtml中呈现响应,则需要13-15秒。对于该表的单行,在页面中获得响应的总时间约为15-18秒。最多将有300行,我担心性能。谁能帮我解决这个问题。我提到了我的示例bean代码和xhtml ajax调用组件。请参考。

我的托管bean在@ConversationScoped

xhtml示例:

<p:tabView dynamic="true" cache="true" >

 <p:outputPanel id="summaryPanel" >
 .....
 </p:outputPanel>

<p:tab>

<p:dataTable id="dtGpcReqDetailsOri" value=#{bean.list} var="object" >
<p:column>
    <h:inputText id="amount" style="width: 45px !important; text-align: right !important;" styleClass="dt-input-small add-left-margin-sm"
    validator="#{bean.validateAmount}"
    onkeypress="if(event.which &lt; 48 || event.which &gt; 57) return false;"
    maxlength="6" value="#{tableObject.amount}">
    <p:ajax event="change" process="@this" listener="#{bean.processOnAmount(object)}"
    update="dtGpcReqDetailsOri,:tabView:summaryPanel}" />
                                            </h:inputText>

                                                </p:column>
                    </p:dataTable>                          
    </p:tab>                                            
</p:tabView>

// 这仅需1-3秒即可执行 样品豆:

public void processOnAmount(Object object){
calculateTotalAndAveragesForAmount(object);
procedureCheckCall(object);
}

提前谢谢!

现在,我尝试使用sysout调试生命周期。 日志:

[10/3/18 11:21:13:437 IST] 00000055 SystemOut     O Executed Phase RESTORE_VIEW(1)
[10/3/18 11:21:13:447 IST] 00000055 SystemOut     O Execution Time = 145ms
[10/3/18 11:21:13:447 IST] 00000055 SystemOut     O Executed RESTORE_VIEW Phase APPLY_REQUEST_VALUES(2)
[10/3/18 11:21:13:457 IST] 00000055 SystemOut     O Executed RESTORE_VIEW Phase PROCESS_VALIDATIONS(3)
[10/3/18 11:21:13:465 IST] 00000055 SystemOut     O Executed RESTORE_VIEW Phase UPDATE_MODEL_VALUES(4)
[10/3/18 11:21:13:518 IST] 00000055 SystemOut     O Executed RESTORE_VIEW Phase INVOKE_APPLICATION(5)
[10/3/18 11:21:14:360 IST] 00000055 SystemOut     O Executed RESTORE_VIEW Phase RENDER_RESPONSE(6)
[10/3/18 11:21:14:360 IST] 00000055 SystemOut     O Execution Time = 1058ms

响应时间为1058毫秒,但页面加载时间为15-17秒>

页面组件有问题吗?

0 个答案:

没有答案