简体   繁体   中英

primefaces dataExporter EL exception

I can build with success the following p:dataTable :

<p:dataTable id="questionario" var="risp" value="#{domande.elencoRisposte}" >  
        <f:facet name="header">
                Questionario di #{userBean.nome} #{userBean.cognome}
        </f:facet>
        <p:column>    
                <f:facet name="header">
                        <h:outputText value="Domanda" />
                </f:facet>
                <h:outputText value="#{domande.getDomanda(risp.domanda).testo}" />
        </p:column>
        <p:column>
                <f:facet name="header">
                        <h:outputText value="Risposta" />
                </f:facet>
                <h:outputText value="#{risp.testo}" />
        </p:column>
</p:dataTable>

but I get the exception:

javax.servlet.ServletException: javax.el.PropertyNotFoundException: Property 'getDomanda' not found on type ispra.Questionario
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:229)

when I try to export the with the p:dataExporter component:

<h:commandLink>
    <p:graphicImage value="pdf.png" />
    <p:dataExporter type="pdf" target="questionario" fileName="questionario" />
</h:commandLink>

domande is the managed bean of type ispra.Questionario .

Any ideas?

code snippet:

@ManagedBean(name="domande") 
@SessionScoped 

public class Questionario { 
    private ArrayList<Domanda> elencoDomande; 
    private LinkedHashMap<String,Risposta> risposte; 

    ...

    public Domanda getDomanda(String codice) { 
        return setDomande.get(codice); 
    } 

    public ArrayList<Risposta> getElencoRisposte() { 
        return new ArrayList<Risposta>(this.risposte.values()); 
    }

    ...

} 

Risposta Class has testo and domanda attributes; Domanda Class has testo atribute.

This seems to be a bug in PrimeFaces that they (for some reason) won't fix. I suggest you use the PrimeFaces Extensions exporter . This solved the problem for me.

What is the getDomanda function doing? It looklike you put your Domanda object in and it returns an Domanda object?

Try this:

<h:outputText value="#{risp.domanda.testo}" />

And then the export function will work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM