I have this xhtml:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Test</title>
</h:head>
<h:body>
<h:form>
<h:inputText id="userId"
value="#{user.id}"
valueChangeListener="#{user.changeId}"/>
</h:form>
</h:body>
</html>
And this bean:
@ManagedBean(name="user")
@SessionScoped
public class UserBean implements Serializable {
private String id;
public String getId() { return id;}
public void setId(String id) { this.id = id;}
public void changeId(ValueChangeEvent event) {
id = (String) event.getNewValue();
}
}
I want that value of field id
in my bean will change after I've written in inputText
, but valueChangeListener
doesn't work. Where the problem is ?