【发布时间】:2014-03-13 22:07:42
【问题描述】:
我正在使用 jsf2 和 Richfaces 4。
这是我的 home.xhtml
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:head>
<title>My Web Application</title>
<link rel="stylesheet" href="resources/stylesheet/style.css" />
</h:head>
<h:body>
<h:panelGrid columns="2">
<h:form>
<rich:panel>
<f:facet name="header">
Statut
<div class="status_refresh" style="float:right;">
<h:graphicImage styleClass="loading" value="resources/stylesheet/images/refresh.png">
<f:ajax execute="@form" event="click" listener="#{statusBean.refresh}" render="station_status station_action"/>
</h:graphicImage>
</div>
</f:facet>
<h:panelGroup id="station_status" style="display:inline-block;" class="#{statusBean.stationTableStatus?'status_ok':'status_not_ok'}">
<a4j:outputPanel>
<rich:tooltip rendered="#{statusBean.stationTableStatus != true}">
<h:outputText value="#{statusBean.stationTableStatusMessage}" />
</rich:tooltip>
<h:outputText value="Table " />
<b><h:outputText style="margin-right:10px;" value="Station" /></b>
</a4j:outputPanel>
</h:panelGroup>
<h:panelGroup id="station_action" rendered="#{statusBean.stationTableStatus != true}">
<a4j:status>
<f:facet name="start">
<div class="loading_container">
<h:graphicImage styleClass="loading" value="resources/stylesheet/images/waiting.gif" alt="Please wait ..." />
</div>
</f:facet>
<f:facet name="stop">
<h:commandButton type="button" value="Créer la table">
<a4j:ajax execute="@form" listener="#{statusBean.createStationTable}" render="station_status,station_action"/>
</h:commandButton>
</f:facet>
</a4j:status>
</h:panelGroup>
</rich:panel>
</h:form>
</h:panelGrid>
</h:body>
</html>
通过支持 bean,我有:
public void createStationTable()
{
....
}
和
public void refresh()
{
System.out.println("******* start refresh() ************");
}
而且我不明白为什么我的按钮的侦听器被调用,而不是我的图像之一。
我也试过
public void refresh(ActionEvent actionEvent)
和
public void refresh(AjaxBehaviorEvent e)
但没有一个有效。
我也尝试过使用 f:ajax 和 a4j:ajax。同样的结果。
【问题讨论】: