I'm trying the following basic scenario:
1) A Request scoped bean:
Code: Select all
<managed-bean>
<managed-bean-name>postsBean</managed-bean-name>
<managed-bean-class>com.hexbinama.hdyf.beans.PostsBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
Code: Select all
public class PostsBean {
private String sayHello;
private static int i = 0;
public PostsBean() {
if (log.isDebugEnabled()) {
log.debug("Created Bean.");
}
setSayHello((i++) + "");
}
public void sendAction(ActionEvent event) {
}
public String getSayHello() {
return sayHello;
}
public void setSayHello(String sayHello) {
this.sayHello= sayHello;
}
Code: Select all
<h:form prependId="false">
<h:outputText id="label" value="#{postsBean.sayHello}" />
<h:inputText id="sayHello" value="#{postsBean.sayHello}" />
<p:commandButton value="Send" actionListener="#{postsBean.sendAction}" update="sayHello label"/>
</h:form>
Steps:
a) I start a new session on the browser and then keep pressing F5, both the text as well as the input text will increment value [as expected].
b) I type something inside the input text, click Send. Both label and input text show the new value that was typed.
c) I press F5 again - label shows the incrementing values again, but input text remains 'stuck' on the value that I typed at point b).
I expect it to also start to show incrementing numbers.
Also, a "shorter" version is available:
a) Start new session in browser. Keep pressing F5 and confirm both label and input text show incrementing value. Is normal, scope is request, new bean is created on each F5.
b) type anything in input text. No need to press "Send" button. Just change the value shown in the input text and then press F5. Only label updates, input text remains with the value that is typed within. Expected: it should also show the same value that the label is showing.
Any idea why this happens ?
Thank you,