title: JSF get current values from bean
body: <p>Hi everyone thanks for helping.
  I need to get current values from bean back to jsf.</p>
  
  <p><strong>JSF (example)</strong></p>
  
  <pre><code>&lt;!-- InputText USERNAME  --&gt;
          &lt;h:outputText style="font-size:12px;font-weight:bold;" value="Username"&gt;&lt;/h:outputText&gt;
          &lt;h:inputText a:placeholder="Enter user.." id="username" value="#{regBean.username}" required="true"&gt;&lt;/h:inputText&gt;
          &lt;h:outputText value="&amp;lt;br/&amp;gt;" escape="false" /&gt;
  &lt;!-- COMMANDBUTTON SEND --&gt;
          &lt;p:commandButton update=":dialogConf" style="font-size:10px;width:68px;height:32px;margin-left:70px;" type="submit" value="Sign Up" icon="ui-icon-arrowreturnthick-1-e"  styleClass="botonesR"
          onerror="PF('errorDlg').show();" oncomplete="PF('confirmation').show();PF('registration').hide();"
          action="#{regBean.doActionReg}" ajax="true"&gt;
          &lt;/p:commandButton&gt;
  </code></pre>
  
  <p><strong>Bean (example)</strong></p>
  
  <pre><code>public void insertNewUser(){
  
      Connection conn = null;
      PreparedStatement pStatement = null;
      String user = this.getUsername();
      String SQL = "INSERT INTO USER"
              + "(USERNAME)VALUES"
              + "(?)";
      try {
          conn = getdbConnection();
          pStatement = conn.prepareStatement(SQL);
          pStatement.setString(1, user);
          //Execute insertSQL
          pStatement.executeUpdate();
          System.out.println("User:" + user);
          System.out.println("Record is inserted into USUARIOS table");
  
      }catch (SQLException e){
          System.out.println(e.getMessage());
      }finally{
          try{
              if (pStatement!=null){
                  pStatement.close();
              }
              if (conn!=null){
                  conn.close();
              }
          }catch(SQLException e){
              System.out.println(e.getMessage());
          }
      }
  }
  </code></pre>
  
  <p>until here everything works fine records are being saved properly.
  Now I want to see the current user in confirmation dialog after insert query</p>
  
  <p><strong>Same JSF</strong></p>
  
  <pre><code>  &lt;p:dialog header="Confirmation" showEffect="explode" id="dialogConf" widgetVar="confirmation" hideEffect="explode" height="125px" width="378px" modal="true" resizable="false"&gt;
      &lt;h:outputText value="User ( #{regBean.username}) is now in our db"&gt;&lt;/h:outputText&gt;
   &lt;/p:dialog&gt;
  </code></pre>
  
  <p>here #{regBean.username} doesn't show me the current value of username.</p>