javax.el.PropertyNotFoundException:在类型上找不到属性“PrintId”,但此属性已注释

javax.el.PropertyNotFoundException:在类型上找不到属性“PrintId”,但此属性已注释,java,jsf,openfaces,Java,Jsf,Openfaces,我有个例外 javax.el.PropertyNotFoundException: Property 'printIDs' not found on type pl.com.pir.beans.SelectedItemBean at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:237) at javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolv

我有个例外

javax.el.PropertyNotFoundException: Property 'printIDs' not found on type pl.com.pir.beans.SelectedItemBean
at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:237)
at javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:214)
at javax.el.BeanELResolver.property(BeanELResolver.java:325)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:85)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at org.apache.el.parser.AstValue.getValue(AstValue.java:183)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:185)
at com.sun.faces.facelets.el.ELText$ELTextVariable.toString(ELText.java:217)
at com.sun.faces.facelets.el.ELText$ELTextComposite.toString(ELText.java:157)
at com.sun.faces.facelets.compiler.CommentInstruction.write(CommentInstruction.java:77)
at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:437)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1822)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
但在我的代码中,这个方法被注释了,我试图清除web浏览器的catch和cookies,在代码中搜索“printIDs”字符串,所有出现的都被注释了,我查看face-config.xml和web.xml,删除tomcat webapps目录中的webapp,甚至重新启动我的电脑,没有任何帮助

        <!-- MENU GENERATOR -->
    <h:panelGroup layout="block" id="produktMenu">
            <o:dataTable value="#{productBean.productList}" var="produkt" pageSize="10"
                         style="margin-top: 15px; width: 100%; height: 420px;">
                         <o:multipleRowSelection rowDatas="#{productBean.list}" style="background: #a4aec5; color: white;" />
            <o:columnReordering />
            <f:facet name="columnMenu">
                <o:columnMenu />
            </f:facet>

            <o:column header="Kategoria" width="7%"
                sortingExpression="#{produkt.kategoria}"
                bodyStyle="padding-left: 5px; padding-right: 5px;"
                headerStyle="text-align: left; padding-left: 5px; padding-right: 5px;">
                <f:facet name="subHeader">
                    <o:dropDownFieldFilter maxlength="4" customValueAllowed="false" />
                </f:facet>
                <h:outputText value="#{produkt.kategoria}" />
            </o:column>

            <o:selectionColumn style="width: 6%;" sortable="true"
                header="Selection">
                <f:facet name="header">
                    <o:selectAllCheckbox />
                </f:facet>
            </o:selectionColumn>
            <f:facet name="below">
                    <o:dataTablePaginator id="paginator" />
                </f:facet>
                <o:column id="symbolCol1" sortingExpression="#{produkt.symbol}">
                    <f:facet name="header">
                        Symbol
                    </f:facet>
                    <h:outputText value="#{produkt.symbol}" />
                </o:column>
                <o:column id="opisCol1" sortingExpression="#{produkt.opis}">
                    <f:facet name="header">
                        Opis
                    </f:facet>
                    <h:outputText value="#{produkt.opis}" />
                </o:column>
                <o:column id="cenaCol1" sortingExpression="#{produkt.cena}">
                    <f:facet name="header">
                        Cena
                    </f:facet>
                    <h:outputText value="#{produkt.cena}" />
                </o:column>
            </o:dataTable>

    </h:panelGroup>
    <h:commandButton value="Dodaj" action="#{selectedItemBean.submit}" />

    <o:dataTable value="#{productBean.list}" var="l" id="resultTable">
        <o:column id="resultSumbolCol" sortingExpression="#{l.symbol}">
            <f:facet name="header">
                        Symbol
                    </f:facet>


            <h:outputText value="#{l.symbol}" />
        </o:column>
        <o:column id="resultOpisCol" sortingExpression="#{l.opis}">
            <f:facet name="header">
                        Opis
                    </f:facet>
            <h:outputText value="#{l.opis}" />
        </o:column>
        <o:column id="resultCenaCol" sortingExpression="#{l.cena}">
            <f:facet name="header">
                        Cena
                    </f:facet>
            <h:outputText value="#{l.cena}" />
        </o:column>
    </o:dataTable>
选择一个源:

    public String submit() {
    for (Map.Entry<Integer, Boolean> entry : selectedIDs.entrySet()) {
        if (entry.getValue() == true) {
            System.out.println("id: " + entry.getKey() + ", "
                    + entry.getValue());
            id.add(entry.getKey());
        }
    }
    System.out.println("SelectedItemBean.submit() --> " + id.size());
    return "selected";
}

public String printIDs() {
    int i = 0;
    if (id.isEmpty())
        return null;
    System.out.println("printIDs <--");
    Iterator<Integer> it = id.iterator();
    while (it.hasNext()) {
        i++;
        System.out.println(it.next());
    }
    System.out.println("suma produktow: " + i + "\nprintIDs -->");
    pb = new ProductBean();
    StringParse sp = new StringParse();
    idList = sp.prepareInStatement(id);
    try {
        list = pb.getProductByID(idList, 2);
        suma = cumputeCosts(list);
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return "TESTprintIDs";
}
为什么我总是收到这个异常?

SelectedItemBan应该有一个PrintId字段的访问器

表达式语言使用getter方法进行属性解析

您可以通过以下方式更改现有代码:

public String getPrintIDs() { //Notice new signature
    int i = 0;
    if (id.isEmpty())
        return null;
    System.out.println("printIDs <--");
    Iterator<Integer> it = id.iterator();
    while (it.hasNext()) {
        i++;
        System.out.println(it.next());
    }
    System.out.println("suma produktow: " + i + "\nprintIDs -->");
    pb = new ProductBean();
    StringParse sp = new StringParse();
    idList = sp.prepareInStatement(id);
    try {
        list = pb.getProductByID(idList, 2);
        suma = cumputeCosts(list);
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return "TESTprintIDs";
}
SelectEditEmban应具有PrintId字段的访问器

表达式语言使用getter方法进行属性解析

您可以通过以下方式更改现有代码:

public String getPrintIDs() { //Notice new signature
    int i = 0;
    if (id.isEmpty())
        return null;
    System.out.println("printIDs <--");
    Iterator<Integer> it = id.iterator();
    while (it.hasNext()) {
        i++;
        System.out.println(it.next());
    }
    System.out.println("suma produktow: " + i + "\nprintIDs -->");
    pb = new ProductBean();
    StringParse sp = new StringParse();
    idList = sp.prepareInStatement(id);
    try {
        list = pb.getProductByID(idList, 2);
        suma = cumputeCosts(list);
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return "TESTprintIDs";
}

您没有显示注释代码,但我猜您使用了经典的xml注释

<!--  ...   -->
我必须说,默认情况下,EL是执行的,即使它是在注释中。对于此问题,您可以使用以下两种解决方案之一:

首先,您可以通过添加以下内容全局禁用注释中的EL解析:

<context-param>
  <param-name>facelets.SKIP_COMMENTS</param-name>
  <param-value>true</param-value>
</context-param>
在web.xml文件中


另一个解决方案是将注释包含在ui:remove标记中。

您没有显示注释代码,但我猜您使用的是经典的xml注释

<!--  ...   -->
我必须说,默认情况下,EL是执行的,即使它是在注释中。对于此问题,您可以使用以下两种解决方案之一:

首先,您可以通过添加以下内容全局禁用注释中的EL解析:

<context-param>
  <param-name>facelets.SKIP_COMMENTS</param-name>
  <param-value>true</param-value>
</context-param>
在web.xml文件中


另一个解决方案是将您的评论放在ui:remove tag中。

@user1853125很高兴我能提供帮助。如果您认为此答案解决了您的问题,请接受。@user1853125但el仍将被执行。就在这种情况下,你将拥有一个财产。在你们写的标题中,el被评论了?@user1853125很高兴我能帮上忙。如果您认为此答案解决了您的问题,请接受。@user1853125但el仍将被执行。就在这种情况下,你将拥有一个财产。在你们写的标题中,el被评论了?