Other field's is input fields. They are submitted by form. Table isn't input. It is not submit'ed. So after request, request scoped bean i recreated, and input field's is submitted. Here you can read about lifecicle of JSF:

http://www.ibm.com/developerworks/library/j-jsf2/

You just have to store list in another scope (session, or some custom, like pageFlowScope)

Admirolas
2011.04.13 11:20, Me Self rašė:
Its requestScope. I know the bean is recreated for every request
however the input fields will be repopulated from the page form before
the action method is called. I have other input fields in the form
that I didnt show in the code snippets and they work as expected - its
only the table thats not being repopulated.



On Wed, Apr 13, 2011 at 9:53 AM, Admirolas<[email protected]>  wrote:
What scope of PageBean is? If it is Request scoped, then it should work like
this. After every request bean is rebuilt. You should move bean to Session
scope or Trinidad's pageFlowScope (Read Developer Guide).
Admirolas

2011.04.13 10:01, Me Self rašė:
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