0

我的页面包含以下代码:

<h:body>
<h:form>
    <h:graphicImage id="logo" alt="pir logo" url="/images/logo.png" />
    <h1>Wybrane produkty:</h1>
    <h:dataTable value="#{selectedItemBean.list}" var="l"
        styleClass="order-table" headerClass="order-table-header"
        rowClasses="order-table-odd-row,order-table-even-row">
        <h:column>
            <f:facet name="header">
                        Symbol
                    </f:facet>
                        #{l.symbol}
                </h:column>
        <h:column>
            <f:facet name="header">
                        Opis
                    </f:facet>
                        #{l.opis}
                </h:column>
        <h:column>
            <f:facet name="header">
                        Cena
                    </f:facet>
                        #{l.cena}
                </h:column>
    </h:dataTable>
    <input value="Popraw" type="button" onclick="history.go(-1)" />
    <h:commandButton value="Print" action="#{selectedItemBean.printPDF}" />
</h:form>

当我尝试执行命令按钮时,出现以下异常:

SEVERE: javax.el.MethodNotFoundException: Method not found: pl.com.pir.beans.SelectedItemBean@7cd2da43.printPDF()

我想知道我做错了什么?

豆源:

@ManagedBean
@SessionScoped
    public class SelectedItemBean implements Serializable {
        private static final long serialVersionUID = 1L;
        private List<Product> list = new ArrayList<Product>();

        public SelectedItemBean() {}

        //................. SOME CODE

        public void printPDF() {
            PrintToPDF pdf = new PrintToPDF();
            try {
            pdf.createPdf("", list);
            } catch(IOException ioe) {
                ioe.printStackTrace();
            } catch(DocumentException de) {
                de.printStackTrace();
            }
        }

        //................. SOME CODE

    }

result.xhtml 中的数据表已正确完成,我已经阅读了很多有关此异常的信息,但我还没有找到解决方案。

4

0 回答 0