java - Passing Parameters to a function JSF -
hi guys need pass parameters actionlistener code
<p:dialog id="dialog" header="acceso restringido" widgetvar="dlgregister" modal="true"> <h:form> <h:panelgrid columns="2" cellpadding="5"> <h:outputlabel for="username" value="nombre de usuario:" /> <p:inputtext value="#{loginbean.usuario.username}" id="username" required="true" label="username" /> <h:outputlabel for="password" value="contraseƱa:" /> <h:inputsecret value="#{loginbean.usuario.password}" id="password" required="true" label="password" /> <h:outputlabel for="correo" value="correo:" /> <h:inputsecret value="#{loginbean.usuario.correo}" id="correo" required="true" label="correo" /> <f:facet name="footer"> <p:commandbutton id="regbutton" value="registrar" update=":growl" actionlistener="#{loginbean.login(actionevent)}" oncomplete="handleloginrequest(xhr, status, args)"/> </f:facet> </h:panelgrid> </h:form>
well need pas svalue="#{loginbean.usuario.username}" example actionlistener="#{loginbean.login(actionevent,---here----)}"
actionlistener="#{loginbean.login(actionevent)}"
this not right. there not exist managed bean #{actionevent}
in scope @ all. jsf prepare real actionevent
argument action listener methods. omit it:
actionlistener="#{loginbean.login}"
jsf implicitly create , pass right argument.
you can access username straight inside method:
public void login(actionevent event) { system.out.println(usario.getusername()); // look, it's been set jsf. }
Comments
Post a Comment