Sunday, March 20, 2011

Which Letter Not On Ontario Licence Plate

Basics Tutorial Web applications with NetBeans Part 4

Continuing with the basic tutorial with NetBeans Web applications, this section will see the application running and create a page to display data sent from the user.


Edit the Login bean and replace the definition of the class
long serialVersionUID = 1L;

and add the import java. io.Serializable





public String validate
() {return
"user";}

The value of "user" is the name of the page usuario.xhtml.
index.xhtml Edit and add in action = "# {login.Validar} a \u0026lt;h: commandButton
\u0026lt;h:commandButton value="Entrar" action="#{login.Validar}"/>

create a new page
Web Pages select New-> Java Server Faces and JSF Page file type



indicate the name



add \u0026lt;h: outputText to display the name of the user loginscreen  <h:outputLabel value ="#{login.username}"/>

quedarĂ­a
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head>
\u0026lt;title> Facelet Title \u0026lt;/ title>
\u0026lt;/ h: head>
\u0026lt;h:body> ;
\u0026lt;h:outputLabel value ="#{login.username}"/>
\u0026lt;/ h: body>
\u0026lt;/ html>
Now run the application}


and to click the Login button brings us to the next page and shows the user name that we entered on the previous page.





0 comments:

Post a Comment