Seam fails to reRender content for an empty entity
bcowdery.bcowdery.gmail.com Jun 17, 2008 6:39 PMHi All,
I'm writing a simple e-mailer with Seam 2.0.2.GA and RichFaces and I'm running into issues with the AJAX support. It won't reRender unless there is content in the Entity for the area I'm attempting to reRender, which is a problem because its a changing list that can be filled and emptied at will.
I have it set up so that you can add multiple addresses by clicking an add
button beside a text field, which builds a list of addresses reRenders a recipient
area to include the newly added address.
<s:decorate id="addToAddressDecoration" template="layout/edit.xhtml"> <ui:define name="label">To:</ui:define> <h:inputText id="to" value="#{emailAddressBean.to}" size="80"> </h:inputText> <a:commandLink action="#{emailHome.addToAddress(emailAddressBean.to)}" reRender="addToAddressDecoration,recipientsDecoration" value="Add" title="click to add"/> </s:decorate>
You can click an added address to remove it and again, it reRenders the recipient
area to show the change.
<s:decorate id="recipientsDecoration" template="layout/edit.xhtml"> <ui:define name="label">Recipients:</ui:define> <h:outputText value="No recipients" rendered="#{empty emailHome.instance.recipients}"/> <ui:repeat value="#{emailHome.instance.to}" var="to"> <a:commandLink value="to: #{to}; " action="#{emailHome.removeToAddress(to)}" reRender="recipientsDecoration" bypassUpdates="true" title="click to remove"/> </ui:repeat> </s:decorate>
Note that emailAddressBean is a backing bean used to pass the address to a method in EmailHome, which updates the list.
The problem is that when i try and remove the last address in the list (the final element, which leaves the list empty), the field won't re-render! I've added logging to my action and it does remove the clicked address from the entity's list, however the view is never updated.
Any help will be greatly appreciated.