a4j:repeat value is null when try to access row
mglowacki Dec 16, 2008 9:11 AMhi,
I am trying to migrate from JBoss 4.0.5 with Tomcat 5.5 to JBoss 4.2.3 with Tomcat 6.0. This also includes myfaces included in the pack etc. Not so easy for me, but most of the components works fine. Except a4j:repeat. It is rendered correctly, but then, when I try to click fx command link in it, value of the repeat component is null!
fragments:
JSP:
<jsp:root version="1.2" xmlns:a4j="http://richfaces.org/a4j" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:t="http://myfaces.apache.org/tomahawk" xmlns:ui="http://www.sun.com/web/ui"> ... <a4j:repeat binding="#{event$ManageEvents.categoryRepeat}" id="eventsTable" value="#{event$ManageEvents.eventsPending}" var="category_it"> <t:htmlTag style="background-color: #3D70A6" value="tr"> <h:outputText escape="false" value="<td colspan=16>"/> <h:outputText style="color: white; margin-left: 2px; font-weight: bold" value="#{category_it.categoryName}"/> <h:outputText escape="false" value="</td>"/> </t:htmlTag> <a4j:repeat binding="#{event$ManageEvents.eventRepeat}" id="eventRow" value="#{category_it.events}" var="event_it"> <t:htmlTag style="#{event_it.styleForEventRow}" value="tr"> <t:htmlTag style="#{event_it.styleForEventDate}; width: 80px; font-size: 12px" value="td"> <ui:hyperlink action="#{event$ManageEvents.editEvent}" immediate="true" style="width: 80px; font-size: 12px" text="#{event_it.eventStart}" toolTip="Click to edit"/> </t:htmlTag> <t:htmlTag style="#{event_it.styleForEventName}; width: 100%; font-size: 12px" value="td"> <a4j:commandLink immediate="true" onclick="openWindow('/AdminConsole/faces/items/GameItems.jsp?event=#{event_it.eventId}')" style="#{event_it.styleForEventName}; font-size: 12px"> <h:outputText escape="false" value="#{event_it.eventName}"/> </a4j:commandLink> ...
JAVA
private HtmlAjaxRepeat categoryRepeat = new HtmlAjaxRepeat (); private HtmlAjaxRepeat eventRepeat = new HtmlAjaxRepeat (); public HtmlAjaxRepeat getCategoryRepeat() { return categoryRepeat; } public void setCategoryRepeat(HtmlAjaxRepeat categoryRepeat) { this.categoryRepeat = categoryRepeat; } public HtmlAjaxRepeat getEventRepeat() { return eventRepeat; } public void setEventRepeat(HtmlAjaxRepeat eventRepeat) { this.eventRepeat = eventRepeat; } ... public String editEvent() { try { adminconsole.event.model.EventsIterator model = (adminconsole.event.model.EventsIterator)((adminconsole.event.model.EventsCategoryIterator)categoryRepeat.getRowData()).getEvents().getRowData(); getAdminSession().setAttribute("event_id", model.getEventId()); getAdminSession().setLastViewId(); return "editEvent"; } catch(Exception ex) { log.error("editEvent", ex); return null; } }
also get "NoRowAvailableException", but it's because the value of the repeat is null...
What I needed to change in web.xml (excluding richfaces stuff) was change to RI-JSF-Implementation. I guess it's the reason. But how to fix it now? I tried to change from HtmlAjaxRepeat to UIRepeat, but jps generated class cast exception, cannot cast HtmlAjaxRepeat to UIRepeat...
Thanks in advance for any suggestions,
Michal