我有一个数据表格
<p:dataTable id="db"
value="#{notificationBox.notificationsList}"
var="notificationForm"
rows="15"
emptyMessage="${msgs.getMessage('table.empty.message')}"
paginator="true"
paginatorPosition="bottom"
rowKey="#{notificationForm}"
selection="#{notificationBox.notification}"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} ( ${notificationBox.notificationsList.size()} ${msgs.getMessage('table.records')} )"
selectionMode="single"
tableStyle="height:430px">
//Rest of the code
如果我选择了任何一行,我会发起一个ajax调用(与primefaces即时行选择示例中相同)。Ajax位于Datatable内部。
<p:ajax event="rowSelect" listener="#{notificationBox.onRowSelect}"
oncomplete="carDialog.show();" />
我的Backing Bean类 -
private List<NotificationForm> notificationsList;
public NotificationForm notification;
public void onRowSelect(SelectEvent event) {
LOGGER.info("Here. +"+notification);
}
//Setter and Getters.
问题在于,如果我选择任何一行,"notification" 值为 null。我无法进一步处理,请帮忙。欢迎提供任何替代方法。
编辑:-
我的托管 Bean 范围 -
<managed-bean>
<managed-bean-name>notificationBox</managed-bean-name>
<managed-bean-class>com.comviva.workflow.ui.notification.NotificationBox</managed-bean-class>
<managed-bean-scope>view</managed-bean-scope>
<managed-property>
<property-name>notificationDao</property-name>
<value>#{notificationDaoService}</value>
</managed-property>
<managed-property>
<property-name>userInfoDao</property-name>
<value>#{userInfoDaoProxy}</value>
</managed-property>
</managed-bean>
#{entity.id}
。 - BalusC