title: JSF ValueChangeListener not working
body: <p>I am learning how to use events with JSF. For some reason, the program is not changing the value in the text field when I change the value of the dropdown menu. The page loads and shows "Germany", but does not change the text field to "DE". Any suggestions?</p>
  
  <p>Index.xhtml:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"&gt;
  &lt;h:head&gt;
      &lt;title&gt;Facelet Title&lt;/title&gt;
  &lt;/h:head&gt;
  &lt;h:body&gt;
      &lt;f:view&gt;
          &lt;h:form&gt;
              &lt;h:selectOneMenu value="#{Bean.selectedItem}" valueChangeListener="#{Bean.changeEvent}" onchange="submit()"  &gt;
                  &lt;f:selectItems value="#{Bean.itemsList}" /&gt;
              &lt;/h:selectOneMenu&gt;
              &lt;br /&gt;
              &lt;h:inputText value="#{Bean.selectedItem}" /&gt;
          &lt;/h:form&gt;
      &lt;/f:view&gt;
  &lt;/h:body&gt;
  </code></pre>
  
  <p></p>
  
  <p>MyBean.java</p>
  
  <pre><code>import javax.faces.bean.ManagedBean;
  import javax.faces.bean.RequestScoped;
  import java.util.ArrayList;
  import javax.faces.model.SelectItem;
  import javax.faces.event.ValueChangeEvent;
  @ManagedBean (name = "Bean")
  @RequestScoped
  public class MyBean {
  
  private static ArrayList menuItems;
  private String selectedItem = "EN";
  static {
      menuItems = new ArrayList();
      menuItems.add(new SelectItem("EN", "English"));
      menuItems.add(new SelectItem("DE", "Germany"));
  }
  
  public ArrayList getItemsList() {
      return this.menuItems;
  }
  
  public void setSelectedItem(String item) {
      this.selectedItem = item;
  }
  
  public String getSelectedItem() {
      return selectedItem;
  }
  
  public void changeEvent(ValueChangeEvent e) {
      selectedItem = e.getNewValue().toString();
  }
  
  }
  </code></pre>