我碰壁了。我非常了解 a4j 和 Rich 标签(我使用 Seam 2.2.0 和 Richfaces 3.3.1)。但是,我正在尝试做一些非常简单的事情,但是在丰富的:modalPanel 中。
似乎 rich:modalPanels 不允许触发 Ajax 事件。这是一个简单的细分:我有 ah:selectOneMenu,其中包含一些项目,其值附加到支持 bean。附加到该 h:selectOneMenu 的是 a4j:support 标记,因此每当触发更改事件时,支持 bean 都应该得到更新。真正简单的东西嗯?
但是,当这个 h:selectOneMenu 在 rich:modalPanel 中时,onchange 事件不会更新支持 bean,直到 rich:modalPanel 关闭。
我可以确认这一点,因为我在 Eclipse 调试模式下运行它,并且我在连接到 h:selectOneMenu 的属性的设置器上有一个断点。这让我发疯!这是 Ajax 的普通内容,但 rich:modalPanels 似乎不允许这样做。
所以,问题是:我可以在 rich:modalPanel 中做 Ajax 的东西吗?我基本上是在尝试使用 rich:modalPanel 作为一种表单(我尝试过 a4j:form 和 h:form 无济于事),它对下拉列表的更改做出反应(例如,当用户更改下拉列表时,某个表单的一部分应该重新渲染)。我是否正在尝试做一些不可能的事情?
这是 modalPanel 的简化版本:
<rich:modalPanel id="quickAddPanel">
<div>
<a4j:form id="quickAddPaymentForm" ajaxSubmit="true">
<s:decorate id="paymentTypeDecorator">
<a4j:region>
<h:selectOneMenu
id="paymentType"
required="true"
value="#{backingBean.paymentType}"
tabindex="1">
<s:selectItems
label="#{type.description}"
noSelectionLabel="Please select..."
value="#{incomingPaymentTypes}"
var="type"/>
<s:convertEnum/>
<a4j:support
ajaxSingle="true"
event="onchange"
eventsQueue="paymentQueue"
immediate="true"
limitToList="true"
reRender="paymentTypeDecorator, paymentDetailsOutputPanel, quickAddPaymentForm"/>
</h:selectOneMenu>
</a4j:region>
</s:decorate>
</fieldset>
<fieldset class="standard-form">
<div class="form-title">Payment details</div>
<a4j:outputPanel id="paymentDetailsOutputPanel">
<h:outputText value="This should change whenever dropdown changes: #{backingBean.paymentType}"/>
</a4j:outputPanel>
</fieldset>
</a4j:form>
</div>
</rich:modalPanel>
问候,安迪