I am switching from RichFaces 3.3.3 to 4.0 and am facing a problem that cannot figure out how to solve.
So far, I have used the @KeepAlive RichFaces annotation to reach the View area with beans, but in new version 4 there is no such function yet (as far as I know). So I thought the @ViewScoped annotation would be a natural (and quick) replacement, but it does not work. Here is the relevant code that gives me problems. It displays a table containing clients with names as links, so when you click on a name, it brings up a pop-up window for editing data. It works in v3.3.3 with @KeepAlive, but not in v4 with @ViewScoped (popup does not get called).
Page:
<h:form prependId="false"> <rich:dataTable id="table" value="#{myBean.customers}" var="customer"> <h:column> <a4j:commandLink action="#{myBean.selectCustomer}" oncomplete="#{rich:component('popup_customer_editor')}.show();" render="form_customer_editor"> ${customer.name} <f:setPropertyActionListener value="#{customer}" target="#{myBean.selectedCustomer}"/> </a4j:commandLink> </h:column> <h:column>${customer.address}</h:column> </rich:dataTable> </h:form> <rich:popupPanel id="popup_customer_editor> <h:form id="form_customer_editor"> </h:form> </rich:popupPanel>
bean:
@ManagedBean @ViewScoped //It was @KeepAlive before public class MyBean implements Serializable { private String name; private String address; private Customer selectedCustomer; //POJO class //getters and setters ... public String selectCustomer() { name = selectedCustomer.getName(); address = selectedCustomer.getAddress(); return null; } }
Any help would be appreciated
source share