I have this primefaces index page:
<p:layoutUnit position...>
<h:form>
<p:outputLabel for="txt" value="enter 6 digits">
<p:inputMask id="txt" value="#{bean.txt}" mask="999-999">
<p:inputLabel for="date1" value="choose date:">
<p:calendar id="date1" value="#{bean.date1}">
<p:commandButton value="submit" actionListener="#{bean.submit}"/>
</h:form>
</p:layoutUnit>
<p:layoutUnit position ...>
<h:form>
<p:dataTable var="data" value="#{bean.result}">
<p:column headerText="result">
#{data}
</p:column>
</p:dataTable>
</h:form>
</p:layoutUnit>
//class Bean.java //the bean is sessionscopped
private String txt;//setter and getter
private Date date1;
private List<String> result;
public List<String> getList()
{return result;}
public void submit()
{
// here the code I get str and add to list using loop
//it's a large code to paste here
result.add(str);
}
when click submit button it display the result but when choose another date to start again search the old data stay displayed in datatable and no new data displayed that the problem! If i refresh the page the new result displayed.
How to solve that?