myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Me Self <wmso...@gmail.com>
Subject Re: [trinidad 1.2] table rows not populated
Date Wed, 13 Apr 2011 08:20:13 GMT
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 <admirolaz@gmail.com> 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?
>
>
Mime
View raw message