【问题标题】:Primefaces backbean bean update taken timePrimefaces backbean bean 更新耗时
【发布时间】:2015-12-08 07:54:48
【问题描述】:

我尝试使用 backbean 更新面板来更新它,因为

one.xhtml

.....
<h:form>
<p:panel id="contentPanel">
.....
<ui:include src="#{main.pagePath}/>
</p:panel

</h:form>

两个.xhtml

.......
<h:form>
....
<p:commandButton id="save" action="#{user.saveAction} update=currentpanel,:#{p:component('contentPanel')}/>
</h:form>

在此更新中 saveButton 验证失败需要更新当前面板但它也更新 contentPanel 所以我尝试使用 backbean 来更新

user.java

public String saveAction()
{
if(validateFiled)
{
....
.....
RequestContext.getCurrentInstance.update('contentPanel');
}
return null;
}

但更新面板需要更多时间

【问题讨论】:

  • update=currentpanel,:#{p:component('contentPanel')}/ 解释一下这个corect c/p

标签: jsf-2 primefaces


【解决方案1】:

要更新前端的组件,您需要使用一些 CSS 或 jQuery 选择器来选择组件。例如。 update="@form"update="@(.className)" 或完整的组件 ID

update=":formID:namingContainerIDifExsists:componentID"

在后台 bean 中,您需要放置一个完整的 id 组件,就像您在控制台中看到的那样,或者调试:

RequestContext.getCurrentInstance.update('formID:contentPanel');

如果您有多个表单,请给它们一个唯一的 ID

【讨论】:

    猜你喜欢
    • 2013-01-24
    • 2021-08-09
    • 2012-04-21
    • 2023-03-23
    • 2013-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多