I have a <tr:table> with an "add row" button but whenever the user
presses a <tr:commandButton> in that table then the list thats backing
up the table is reset. All other fields in the managed bean are
repopulated as expected.

The managed bean is request scoped:

public class PageBean {
        private List<Dto> dtoList = new ArrayList<Dto>();

        public String addRow() {
                dtoLists.add(new Dto("", ""));
                return "";
        }
        ...
}

The page is built using facelets 1.1.4:


          <tr:form>
                <tr:table value="#{pageBean.dtoList}"
                         var="dto">
                        <f:facet name="actions">
                                <tr:commandButton id="addrow" text="addrow"
                                        action="#{pageBean.addRow}" 
value="addrow" />
                        </f:facet>
                        <tr:column>
                                <f:facet name="header">
                                        <tr:outputText value="Name" />
                                </f:facet>
                                <tr:inputText value="#{dto.name}" />
                        </tr:column>
                        ...
                </tr:table>

If I change the managed bean to be session scoped then the list is not
lost between postbacks. But how do I make it work with request scope?

Reply via email to