JSF:如何显示"等待"消息?



我创建了一个联系人表单,但是现在我想显示一个等待消息,例如'正在发送消息'

这是我到目前为止所做的:

<h:form styleClass="contact">
    <h:inputText id="name" value="#{contact.client.name}" styleClass="text-input" >
        <f:ajax event="blur" render="nameMessage" />
    </h:inputText>
    Name (Required)
    <br />
    //..
    <a4j:commandButton value="Do something" action="#{contact.sendMessage}" status="ajaxStatus" />

    <!-- warning messages -->
    <h:messages globalOnly="true" errorClass="errorMessage" infoClass="infoMessage" showSummary="true" showDetail="true" />
    <h:message id="nameMessage" for="name" errorClass="error" /><br />
</h:form>
<a4j:status id="ajaxStatus" name="ajaxStatus">
    <f:facet name="start">
        <h:graphicImage name="loader.gif" library="images" />
        <h:outputText value="Your message" />
    </f:facet>
</a4j:status>
<<p> 解决方案/strong>:基于@roel提示:
    <h:form styleClass="contact">
        <h:inputText id="name" value="#{contact.client.name}" styleClass="text-input" >
            <f:ajax event="blur" render="nameMessage" />
        </h:inputText>
        Nome (Obrigatório)
        //..        
        <a4j:commandButton value="Enviar" action="#{contact.sendMessage}" styleClass="button" status="ajaxStatus" />

        <!-- warning messages -->
<!--         <h:messages globalOnly="true" errorClass="errorMessage" infoClass="infoMessage" showSummary="true" showDetail="true" /> -->
        <h:message id="nameMessage"    for="name"    errorClass="error" /><br />
        //..
    </h:form>
    <a4j:status name="ajaxStatus">
        <f:facet name="start">
            <h:graphicImage name="loader.gif" library="images" />
            <h:outputText value="Aguarde um momento ..." />
        </f:facet>
    </a4j:status>

但我不知道为什么不工作。你知道吗?

但是要使用ypur a4j:status,我认为您要么将它放在表单之外,不带名称和引用。在ajax调用中没有引用

<a4j:commandButton value="Do something" action="#{contact.sendMessage}"  />

或者留下名字和状态参考你必须把它放在表单

我们使用了一个弹出式面板

<rich:popupPanel modal="true" id="busy" width="300" height="150" zindex="10"
        moveable="false" resizeable="false">
<h:outputText value="#{msg.busy_please_wait}" />
</rich:popupPanel>

在ajax调用中我们使用onbegin和oncomplete来显示和隐藏它。

<a4j:ajax id="postalCode" event="change" listener="#{myclass.retrievePostalCode}" render="cityGroup address " execute="country houseNumber address city"  oncomplete="#{rich:component('busy')}.hide();" onbegin="#{rich:component('busy')}.show()"/>

只要我需要进程加载,我就会这样做Richfaces.showModalPanel (pleaseWaitPanel);

,这里是模型面板:

<rich:modalPanel id="pleaseWaitpanel" width="yourChoice" height="yourChoice" autosized="true">
<t:panelGrid columns="1" style="width:100%;" >
        <t:div style="width:100%;text-align:center;">
            <t:graphicImage url="look in google for processloading.gif"/>
        </t:div>
    </t:panelGrid>
</rich:modalPanel >

相关内容

  • 没有找到相关文章

最新更新