Componentes
Last updated
Was this helpful?
Last updated
Was this helpful?
Los componentes nos permiten extender los elementos Java Server Faces
Dentro de resources crear la carpeta avbravo
Crear dos paginas
accesodenegado.xhtml
activo.xhtml
<?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://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:b="http://bootsfaces.net/ui">
<composite:interface >
<composite:attribute name="renderedcondition" />
</composite:interface>
<composite:implementation>
<h:form id="formaccesodenegado" rendered="#{cc.attrs.renderedcondition}">
<b:panel look="danger" title="#{app['title.accesodenegado']}">
<h:panelGrid columns="2" cellpadding="5">
<p:commandButton class="btn btn-success" action="#{loginController.irLogin}"
value="#{app['button.return']}" ajax="false"/>
</h:panelGrid>
</b:panel>
</h:form>
</composite:implementation>
</html>
<?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://xmlns.jcp.org/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:b="http://bootsfaces.net/ui">
<composite:interface >
<composite:attribute name="beanValue" />
<composite:attribute name="rendered"/>
</composite:interface>
<composite:implementation>
<b:selectOneMenu id="activo" value="#{cc.attrs.beanValue}"
required="true"
rendered="#{cc.attrs.rendered}"
requiredMessage="#{app['title.activo']} #{app['info.notnull']}">
<f:selectItem itemLabel="#{app['button.yes']}" itemValue="si" />
<f:selectItem itemLabel="#{app['button.no']}" itemValue="no" />
</b:selectOneMenu>
</composite:implementation>
</html>