0

I'm passing a parameter to a <ui:composite> page as a solution proposed here. It works perfectly in other cases, but in this one, the parameter passed is always null. Here's the code:

dados.xhtml -> it's placed at resources/protocolo/

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

<composite:interface>
    <composite:attribute name="protocolo" />
</composite:interface>

<composite:implementation>
    <p:panel header="Protocolo #{protocolo.id}   |     #{protocolo.situacao.descricao}">
        <p:panelGrid style="text-align: center; width: 100%;" >
            <p:row>
                <p:column> Operação </p:column>
                <p:column> #{protocolo.operacao.descricao} </p:column>
            </p:row>

            <p:row>
                <p:column> Data entrada </p:column>
                <p:column>
                    <h:outputText value="#{protocolo.dataEntrada}">
                        <f:convertDateTime pattern="dd/MM/yyyy"/>
                    </h:outputText> 
                </p:column>
            </p:row>
            <br/>
        </p:panelGrid>
    </p:panel>
</composite:implementation>


</html>

Here's where i call this composite page:

#{protocolo.id}
<protocolo:dados protocolo="#{protocolo}"/>

Calling protocolo.id returns the correct id for the entity, but inside the composite, it returns null. I'm using other composite pages inside this xhtml and it's working perfectly.

Anyone can help?

Community
  • 1
  • 1
AndreDuarte
  • 784
  • 1
  • 5
  • 21
  • But I'm using other composite pages without `cc.attrs` and they are working. Do you know why? – AndreDuarte Jul 09 '15 at 17:33
  • Then those were not composite components, but tagfiles or includes. See also a.o. http://stackoverflow.com/questions/6822000/when-to-use-uiinclude-tag-files-composite-components-and-or-custom-componen to learn the difference. – BalusC Jul 09 '15 at 17:35

0 Answers0