title: @ManagedProperty in backing bean - setting getters and setters
body: <p>According <a href="https://stackoverflow.com/questions/6164078/jsf-java-boolean-switchers-private-for-jsf-public-static-for-beans">this article</a>, I've implemented <code>@ManagedProperty(value="#{settings}")</code> to my backing bean:</p>
  
  <p><strong>BEAN Bde.java:</strong></p>
  
  <pre><code>@Entity
  @Table(name="bdeDATA")
  @ViewScoped
  @ManagedBean(name="BDE")
  public class Bde implements Serializable
  {
    /**/
    private static final long serialVersionUID = -705775502999920673L;
  
    @Transient
    @ManagedProperty(value = "#{settings}")
    private Settings settings;
  
    @Id
    private Date create_date;
    private Integer person_ID;
  
    public Date getCreate_date() {
      return create_date;
    }
    public void setCreate_date(Date create_date) {
      this.create_date = create_date;
    }
    public Integer getPerson_ID() {
      return person_ID;
    }
    public void setPerson_ID(Integer person_ID) {
      this.person_ID = person_ID;
  
      try 
      {
        Settings.PWKITEM = (Pwk)Tools.find(person_ID);
        if (Settings.PWKITEM != null) settings.setUserfound(true); /// PROBLEMATIC
      }
      catch (Exception e)
      {
        Tools.setErrorMessage("NOT FOUND "+e.getMessage());
      }
    }
  
    // ManagedProperty settings ---------------------------------------------  
    public Settings getSettings() {
      return settings;
    }
    public void setSettings(Settings settings) {
      this.settings = settings;
    }
    public void setUserfound (boolean userfound){
      settings.setUserfound(userfound);
    }
    public boolean isUserfound() {
      return settings.isUserfound();
    }
  }
  </code></pre>
  
  <p><strong>Settings.java</strong>:</p>
  
  <pre><code>@SessionScoped
  @ManagedBean(name="settings")
  public class Settings implements Serializable
  {
    /**/
    private static final long serialVersionUID = 8613411699115714416L;
  
    public static Pwk PWKITEM = new Pwk(); 
    private boolean userfound = false;  
  
    public boolean isUserfound() {
      return userfound;
    }
    public void setUserfound(boolean userfound) {
      this.userfound = userfound;
    }
  }
  </code></pre>
  
  <p><strong>XHTML</strong> (ajax call setPerson_ID):</p>
  
  <pre><code>&lt;h:inputText id="persId" value="#{bean.bdeitem.persId}"&gt;
    &lt;f:ajax event="blur" render="name" execute="@this" /&gt;
  &lt;/h:inputText&gt;
  &lt;h:inputText id="name" value="#{bean.pwkitem.name}"/&gt;
  </code></pre>
  
  <p>Problem is in <code>try/catch</code>: </p>
  
  <ul>
  <li>without the condition, object is found.</li>
  <li>when I change the condition for example to <code>if (Settings.PWKITEM != null) System.out.println("HELLO")</code>, <code>HELLO</code> is writen to console. </li>
  <li>if i try to add the <code>userfound</code> setter, it is catched ("NOT FOUND"). </li>
  </ul>
  
  <p>What I'm doing wrong?</p>