OK... I believe I understand what your
doing.
Your adding a new empty object (row) that will render
the two empty HtmlInputText objects, in which the user may use to enter in the
next value.
Side note: In your getData() getter, you're just reloading
the data or page if there is no data?
Thank you very much for the response, this will go a
long ways.
--Todd From: jacob@hookom.net [mailto:jacob@hookom.net] Sent: Monday, December 04, 2006 3:13 PM To: users@javaserverfaces.dev.java.net Subject: RE: HtmlDataTable: UIData.setRow method question Just add another empty object to your dataset (value bound) public class BackingBean { private List data; public void getData() { if (this.data == null) { // lazy load } return this.data; } public void onAddRow() { this.getData().add(new Bean()); } public void onSave() { BeanDao dao = new BeanDao(); for (Bean b : this.getData()) { if (b.hasValue()) { // not empty instance dao.save(b); } } } } <h:dataTable value="#{backingBean.data}" var="foo"> <h:column>Text: <h:inputText value="#{foo.text}"/></h:column> <h:column>Value: <h:inputText value="#{foo.value}"/></h:column> </h:dataTable> <h:commandButton action="#{backingBean.onAddRow}"/> <h:commandButton action="#{backingBean.onSave}"/>
|