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?