我遇到了这个问题。我在h:form中包含两个表。我还尝试将嵌套表包装在不同的h:form标签中。所以我的目标是当用户单击复选框时,在服务器端被解雇的监听器。我使用execute =“@ this”因为我不想发送所有输入.... onevent属性中的javascript事件被触发,但是从不在服务器中的监听器。当我单击复选框时,我可以看到请求被发送到服务器。我不知道为什么它不会被召唤。
查看:
<h:form>
<table id="trades">
<th class="image_cell"></th>
<th>Type</th>
<th>Portfolio</th>
<ui:repeat var="trade" value="#{controller.errorTrades}">
<tr class="trade error">
<td class="image_cell error"><h:graphicImage styleClass="expandable" url="resources/images/plus.png"></h:graphicImage></td>
<td id="type" class="error">#{trade.type}</td>
<td class="error">#{trade.portfolio}</td>
</tr>
<tr class="operations">
<td id="#{trade.murexId}" class="operation_row" colspan="4">
<table id="operations">
<tr class="header">
<th class="empty_cell"></th>
<th class="operation_cell">Operation</th>
<th>Time Transaction</th>
<th>Comment</th>
<th id="delete">Delete</th>
</tr>
<ui:repeat var="operation" value="#{trade.operationsSortList}">
<tr class="operation">
<th class="empty_cell"></th>
<td id="operation" class="operation_cell color">#{operation.operation}</td>
<td class="color">#{operation.time}</td>
<td class="color">#{operation.coment}</td>
<td class="color checkbox">
<h:selectBooleanCheckbox title="delete">
<f:ajax execute="@this" event="click" listener="#{controller.onDelete}" onevent="onDeleteProcess" />
<f:attribute name="murexId" value="#{trade.murexId}" />
<f:attribute name="operationId" value="#{operation.id}" />
</h:selectBooleanCheckbox>
</td>
</tr>
</ui:repeat>
</table>
</td>
</tr>
</ui:repeat>
</table>
</h:form>
控制器:
@ViewScoped
public class Controller
{
private ArrayList trades;
private ArrayList errorTrades = new ArrayList();
.......code
public boolean onDelete(AjaxBehaviorEvent event)
{
long murexId = 0;
BigDecimal operationId = null;
boolean result = false;
Trade trade;
Iterator itop;
Operation operation;
......code
return true;
}
}
如果有人可以帮助我,我将非常感激。
由于
答案 0 :(得分:1)
几乎已解决
我得到了它的工作。我用第二个ui包装:用h:form重复,然后我使用执行=“@ form”而不是execute =“@ this”。这就是为什么我把“几乎解决了”......为什么会发生这种情况呢?
<h:form>
<ui:repeat var="operation" value="#{trade.operationsSortList}">
<tr class="operation">
<th class="empty_cell"></th>
<td id="operation" class="operation_cell color">#{operation.operation}</td>
<td class="color">#{operation.time}</td>
<td class="color">#{operation.coment}</td>
<td class="color checkbox">
<h:selectBooleanCheckbox title="delete">
<f:ajax execute="@this" event="click" listener="#{controller.onDelete}" onevent="onDeleteProcess" />
<f:attribute name="murexId" value="#{trade.murexId}" />
<f:attribute name="operationId" value="#{operation.id}" />
</h:selectBooleanCheckbox>
</td>
</tr>
</ui:repeat>
</h:form>
感谢您的支持!