Событие не запускается в моем контроллере. Это код.
Вид:
<ui:repeat var="operation" value="#{trade.operationsSortList}">
<tr class="operations">
<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">
<h:form>
<h:selectBooleanCheckbox>
<f:ajax event="click" listener="#{controller.onDelete}" />
<f:attribute name="trade" value="#{trade}" />
</h:selectBooleanCheckbox>
</h:form>
</td>
</tr>
</ui:repeat>
Контроллер:
@ManagedBean
@RequestScoped
public class Controller
{
private ArrayList trades;
.....
.....
public void onDelete(AjaxBehaviorEvent event) {
Trade trade = (Trade) event.getComponent().getAttributes().get("trade");
}
}
Заранее спасибо!
REDIT:
У меня это работает, но у меня все еще есть проблемы, потому что у меня есть таблицы, поэтому мне нужно обернуть таблицы в тег формы, чтобы я заключил весь вид в тег формы. Моя цель просто отправить на сервер отмеченный флажок! Запрос отправляется на сервер, но слушатель не вызывается. Событие 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>
CONTROLLER:
@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;
}
}
Мне очень важно решить эту проблему.
Спасибо!