jueves, 28 de septiembre de 2017

Primefaces

En esta entrada se observa algunas funcionalidades básicas para una página con JSF y primefaces. Suponiendo que es un login.

Login.xhtml

<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">

<ui:composition template="/WEB-INF/templates/BasicTemplate.xhtml">
<ui:define name="content">
<h:form>
<p:growl id="growl" showDetail="true" sticky="true" />
<p:panel>
<p:panelGrid columns="4" cellpadding="8">
<h:outputLabel for="impUsr" value="Usuario: "></h:outputLabel>
<h:inputText id="impUsr" value="#{loginBean.name}" required="true"
requiredMessage="Introduzca usuario" title="Introduzca usuario"></h:inputText>
<p:message for="impUsr" display="Text" />
<p:tooltip id="toolTipImpUsr" for="impUsr" showEvent="impUsr"
hideEvent="blur" />


<h:outputText value="Password: "></h:outputText>
<h:inputSecret id="impPwd" value="#{loginBean.password}"
required="true" requiredMessage="Introduzca password"
title="Introduzca password"></h:inputSecret>
<p:message for="impPwd" />
<p:tooltip id="toolTipImpPwd" for="impPwd" showEvent="impPwd"
hideEvent="blur" />

</p:panelGrid>
</p:panel>

<h:commandButton value="Login" 
actionListener="#{loginBean.validationMenssage}" ></h:commandButton>

</h:form>
</ui:define>
</ui:composition>

</html>

No hay comentarios:

Publicar un comentario