jsf - When change any input value and submit again no new data displayed to display that it need refresh -


i have 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 sessionscopped

private string txt;//setter , getter private date date1; private list<string> result; public list<string> getlist() {return result;} public void submit() { // here code str , add list using loop //it's large code paste here result.add(str); } 

when click submit button display result when choose date start again search old data stay displayed in datatable , no new data displayed problem! if refresh page new result displayed.

how solve that?

since new data displayed after refresh page, need update <p:datatable> using primefaces's built-in ajax after submit first form.
add id form containing datatable (thanks @kukeltje clarification) :
<h:form id="foo">
, add id datatable tag :
<p:datatable id="beantable" var="data" value="#{bean.result}">
and add commandbutton, select component updating :
<p:commandbutton update=":foo:beantable" value="submit" actionlistener="#{bean.submit}"/>


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -