在类型上找不到javax.el.PropertyNotFoundException属性

时间:2014-02-21 17:34:27

标签: jsf el facelets propertynotfoundexception

我正在使用

  • JSF 2.0
  • JDK 7
  • Linux - Ubuntu 13.04
  • Primefaces 4

问题是我正面临 javax.el.PropertyNotFoundException 我已经尝试/搜索了所有我可以从forums / help-sections / etc中找到的东西,但我无法理解我在哪里错误的指导。以下是我的例外详情

javax.el.PropertyNotFoundException: section-panel.xhtml @99,91 rendered="#{sectionBean.editable}": Property 'editable' not found on type com.example.timeline.backingbeans.SectionBackingBean
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111)
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:193)
    at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:422)
    at javax.faces.component.UIData.iterate(UIData.java:1495)
    at javax.faces.component.UIData.processDecodes(UIData.java:983)
    at javax.faces.component.UIForm.processDecodes(UIForm.java:216)
    at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1048)
    at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:926)
    at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
    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:502)
    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:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

我的网页

<h:dataTable styleClass="table table-striped" var="sectionBean" 
    value="#{sectionBackingBean.listSectionDTO}" rendered="#{sectionBackingBean.visible}">
    <h:column>
        <f:facet name="header">
            <h:outputText value="Section Id" />
        </f:facet>
        <h:outputText value="#{sectionBean.sectionId}" />
    </h:column>

    <h:column>
        <f:facet name="header">
            <h:outputText value="Name" />
        </f:facet>
<!--                                    <h:outputText value="#{sectionBean.name}" />
        <h:inputText value="#{sectionBean.name}" /> -->
        <h:outputText value="#{sectionBean.name}" rendered="#{sectionBean.editable}"/>
        <h:inputText value="#{sectionBean.name}" rendered="#{sectionBean.editable}"/>
    </h:column>

    <h:column>
        <f:facet name="header">
            <h:outputText value="Modify" />
        </f:facet>

        <h:commandLink value="Update" />
        <h:outputLabel value="&#160;&#160;" />
        <h:commandLink value="Delete" />
    </h:column>

</h:dataTable>

我的支持bean是

package com.example.timeline.backingbeans;

import java.util.ArrayList;
import java.util.List;

import javax.faces.component.UICommand;
import javax.faces.component.UIInput;

import com.example.timeline.controller.ControllerMapsOperations;
import com.example.timeline.dto.SectionDTO;
import com.example.timeline.dto.StatusDTO;
import com.example.timeline.utils.GCTimlineConstants;

public class SectionBackingBean extends SectionDTO {

    private final static String _FORM_ADD_SECTION = "form-add-section";

    private StatusBackingBean statusBackingBean;
    private UICommand commandLink;
    private UIInput inputText;
    private ControllerMapsOperations controllerMapsOperations = null;
    private List<SectionBackingBean> listSectionDTO = null;
    private boolean isVisible;
    private boolean editable;


    public boolean isEditable() {
        return editable;
    }

    public void setEditable(boolean editable) {
        this.editable = editable;
    }

    public UIInput getInputText() {
        return inputText;
    }

    public void setInputText(UIInput inputText) {
        this.inputText = inputText;
    }

    public SectionBackingBean() {
        // super();
        listSectionDTO = new ArrayList<>();
        super.setStatusDTO(new StatusDTO());
        statusBackingBean = new StatusBackingBean();
        controllerMapsOperations = new ControllerMapsOperations();
    }

    public List<SectionBackingBean> getListSectionDTO() {
        return listSectionDTO = controllerMapsOperations.getAllSections();
    }

    public void setListSectionDTO(List<SectionBackingBean> listSectionDTO) {
        this.listSectionDTO = listSectionDTO;
    }

    public StatusBackingBean getStatusBackingBean() {
        return statusBackingBean;
    }

    public void setStatusBackingBean(StatusBackingBean statusBackingBean) {
        this.statusBackingBean = statusBackingBean;
    }

    public void setControllerMapsOperations(
            ControllerMapsOperations controllerMapsOperations) {
        this.controllerMapsOperations = controllerMapsOperations;
    }

    public UICommand getCommandLink() {
        return commandLink;
    }

    public void setCommandLink(UICommand commandLink) {
        this.commandLink = commandLink;
    }

    public boolean isVisible() {
        return isVisible;
    }

    @SuppressWarnings("deprecation")
    public String setVisible(boolean isVisible) {
        this.isVisible = isVisible;
        if (this.isVisible == Boolean.TRUE) {
            // MethodBinding mb =
            // FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{sectionBackingBean.setVisible(false)}",
            // new Class[0]);
            // commandLink.setValue("Hide Section");
            // commandLink.setAction(mb);
            // commandLink.setRendered(true);
        }
        return null;
    }

    public ControllerMapsOperations getControllerMapsOperations() {
        return controllerMapsOperations;
    }

    public List<SectionBackingBean> selectAllSectionDetails() {
        return controllerMapsOperations.getAllSections();
    }

    public String navigate() {
        return "add-section";
    }

    public String addSection() {
        if ((getName() == null) || getName().equalsIgnoreCase("")) {
            GCTimlineConstants.getErrorMessage(_FORM_ADD_SECTION,
                    "Can't leave fields empty!");
            return "failure";
        } else {
            ControllerMapsOperations controllerMapsOperations = new ControllerMapsOperations();
            try {
                if (controllerMapsOperations.addSection(this.getName(), this
                        .getStatusDTO().getStatusId()) == Boolean.TRUE) {
                    GCTimlineConstants.getInfoMessage(_FORM_ADD_SECTION,
                            "Section added successfully!");
                    inputText.setValue("");
                    return "success";
                } else {
                    GCTimlineConstants.getErrorMessage(_FORM_ADD_SECTION,
                            "Can't add. Try later!");
                    return "failure";
                }
            } catch (Exception ex) {
                GCTimlineConstants.getErrorMessage(_FORM_ADD_SECTION,
                        ex.getMessage());
                return "failure";

            }
        }
    }


//  public String updateAction(SectionBackingBean sectionBackingBean){
//      sectionBackingBean.setEditable(Boolean.TRUE);
//      return null;
//  }
}

my faces-config.xml

<?xml version="1.0" encoding="UTF-8"?>

<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">

    <managed-bean>
        <managed-bean-name>sectionBackingBean</managed-bean-name>
        <managed-bean-class>com.example.timeline.backingbeans.SectionBackingBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>


    <managed-bean>
        <managed-bean-name>loginBackingBean</managed-bean-name>
        <managed-bean-class>com.example.timeline.backingbeans.LoginBackingBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>

</faces-config>

0 个答案:

没有答案