O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – updating the view using AJAX

Let us create a Login Form with user name and password. When form is submitted, show the login status using AJAX. Perform the following steps for the same:

  1. Create a login.xhtml page with login form as follows:
    <h:form id="loginForm"> <p:panel header="Login Form" style="width: 500px;"> <h:panelGrid columns="2"> <p:outputLabel value="UserName"/> <p:inputText value="#{userController.loginUser.userName}"/> <p:outputLabel value="Password"/> <p:password value="#{userController.loginUser.password}"/> <p:commandButton action="#{userController.login}" value="Login" update="loginStatusMsg"/> <p:commandButton type="reset" value="Reset"/> <p:outputLabel value="#{userController.loginStatus}" id="loginStatusMsg"/> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required