【发布时间】:2013-02-24 18:32:12
【问题描述】:
我有一个简单的问题,如果我的托管 bean 出现问题,我想显示一个弹出窗口。 bean 包含一个可以使用 getter/setter 方法引发的异常列表。
xhtml 是这样的
<rich:panel>
<h:form>
<a4j:commandButton value="Compute Mission"
action="#{missionHandler.generateMissionFeasability}"
render="popupPanel">
</a4j:commandButton>
</h:form>
</rich:panel>
<rich:popupPanel id="popupPanel" modal="true" autosized="true"
resizeable="false" moveable="false" rendered="#{not empty missionHandler.exceptions}">
<f:facet name="header">
<h:outputText value="Exceptions raised during the processing " />
</f:facet>
<f:facet name="controls">
<h:outputLink value="#"
onclick="#{rich:component('popupPanel')}.hide();return false;">
</h:outputLink>
</f:facet>
</rich:popupPanel>
如您所见,我有一个命令按钮,应该在 bean 中调用 generateMissionFeasibility 方法。 该方法将(除其他外)在异常列表中添加异常。
我想检查列表(是否为空)以显示弹出窗口
上面的代码不起作用,因为我认为popup是在bean中的方法结束之前渲染的,并且列表一开始是空的。
【问题讨论】:
-
尝试将面板封装在内部,例如
<h:panelGroup id="group">,并将commandButton的render属性更改为render="group"。