Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You should move your <code>h:form</code> to encapsulate the <code>p:commandButton</code>. That prevent your <code>p:commandButton</code> to submit anything to the bean. You should add it like this :</p> <pre><code>&lt;h:body&gt; &lt;h:panelGrid id="login-panel"&gt; &lt;h:form rendered="#{loginManagedBean.loggedClient eq null}"&gt; &lt;h:panelGroup id="loginPanelGrid"&gt; &lt;h:outputLabel for="username" value="Username:" /&gt; &lt;p:inputText value="#{loginManagedBean.username}" id="username" required="true" label="username" /&gt; &lt;h:outputLabel for="password" value="Password:" /&gt; &lt;p:password value="#{loginManagedBean.password}" id="password" required="true" label="password" /&gt; &lt;f:facet name="footer"&gt; &lt;p:commandButton id="loginButton" value="Login" update="login-panel" action="#{loginManagedBean.login(actionEvent)}"/&gt; &lt;/f:facet&gt; &lt;/h:panelGroup&gt; &lt;/h:form&gt; &lt;p:panelGroup rendered="#{loginManagedBean.loggedClient ne null}" id="okLoginPanelGrid"&gt; &lt;h:outputText id="clienteLogado" value="#{loginManagedBean.loggedClient.client_name}" /&gt; &lt;/p:panelGroup&gt; &lt;/h:panelGrid&gt; &lt;/h:body&gt; </code></pre> <p><strong>Not related :</strong></p> <p>I would also say the shorter a bean lives, the better your memory usage will be. In that way, the bean <code>LoginManagedBean</code> don't need to be <code>SessionScoped</code>, it could even be only <code>RequestScoped</code> if you move your property <code>loggedClient</code> to a SessionScoped attribute.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload