簡體   English   中英

完成bean方法后調用javascript函數

[英]Calling javascript function after finishing bean method

我想在bean actionListener之后執行javascript函數。我使用的是JSF 1.2,richfaces 3.3。在我的情況下,我想在完成bean的方法后顯示一個圖表。我的表格tab正在填充,但是javascript函數無法正常工作。 這是我的嘗試:

<h:form>
<h:commandButton value="Click" actionListener="#{bean.monActionListener}" reRender="tab">
<a4j:support event="onClick" oncomplete="show()" />
</h:commandButton>
<h:form>

<h:form id="sortie">
<rich:dataTable id="tab" rendered="#{not empty bean.listSortie}" 
value="#{bean.listSortie}" var="raison">

<h:column headerClass="headerleftfacet">
    <h:outputText value="#{raison[0]}">
    </h:outputText>
</h:column>
<h:column headerClass="headermiddlefacet">      
    <h:outputText  value="#{raison[1]}" >
    </h:outputText>
</h:column>

</rich:dataTable>

我通過使用<a4j:commandButton>和`解決了此問題:

<h:form>
<h:commandButton value="Click" actionListener="#{bean.monActionListener}" reRender="tab" oncomplete="alert('ok')">

<h:form>

<a4j:outputPanel id="tab">  
<h:form id="sortie">
<rich:dataTable id="tabb" rendered="#{not empty bean.listSortie}" 
value="#{bean.listSortie}" var="raison">

<h:column headerClass="headerleftfacet">
<h:outputText value="#{raison[0]}">
</h:outputText>
</h:column>
<h:column headerClass="headermiddlefacet">      
<h:outputText  value="#{raison[1]}" >
</h:outputText>
</h:column>

</rich:dataTable>
<h:form>
</a4j:outputPanel>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM