# Componentes

## Componentes

Los componentes nos permiten extender los elementos Java Server Faces

* Dentro de resources crear la carpeta avbravo

Crear dos paginas

* accesodenegado.xhtml
* activo.xhtml

![](/files/-Lc1Wibta5qpSTdH0BnP)

## accesodenegado.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>
```

## 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: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>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://avbravo-2.gitbook.io/implementar-plantillas-primefaces-jsf/capitulo-iii.-configuracion/accesodenegado.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
