Here is what I have
<h:inputTextarea id="comment" rows="3" cols="50" value="#{bean.comment}" /><br/>
<p:commandButton value="Comment" actionListener="#{bean.postMessage}" update="comment"/>
so postMessage()
persist data, then set the the value of comment to empty like this
comment.setComment("");
Work great. When I press the button, message is posted, text is cleared. But what weird is when I click refresh, the message appear back inside the inputTextArea
(It does not get posted, just re-appear inside the text box). Is there a way to fix this?
P/S: the reason I want a ajax solution, is to avoid, after the user click the submit button, then hit refresh, result in the same message will get posted twice.