model view controller - JSF get current values from bean -


hi helping. need current values bean jsf.

jsf (example)

<!-- inputtext username  -->         <h:outputtext style="font-size:12px;font-weight:bold;" value="username"></h:outputtext>         <h:inputtext a:placeholder="enter user.." id="username" value="#{regbean.username}" required="true"></h:inputtext>         <h:outputtext value="&lt;br/&gt;" escape="false" /> <!-- commandbutton send -->         <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">         </p:commandbutton> 

bean (example)

public void insertnewuser(){      connection conn = null;     preparedstatement pstatement = null;     string user = this.getusername();     string sql = "insert 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 inserted 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());         }     } } 

until here works fine records being saved properly. want see current user in confirmation dialog after insert query

same jsf

  <p:dialog header="confirmation" showeffect="explode" id="dialogconf" widgetvar="confirmation" hideeffect="explode" height="125px" width="378px" modal="true" resizable="false">     <h:outputtext value="user ( #{regbean.username}) in our db"></h:outputtext>  </p:dialog> 

here #{regbean.username} doesn't show me current value of username.

solved adding update properly

<!-- commandbutton send -->     <p:commandbutton update="userreg" 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}">     </p:commandbutton> 

where show results

  <p:dialog header="confirmation" showeffect="explode" id="dialogconf" widgetvar="confirmation" hideeffect="explode" height="125px" width="378px" modal="true" resizable="false"> <h:outputtext id="userreg" value="user ( #{regbean.username}) in our db"></h:outputtext> 


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -