有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java EL会话对象属性

${sessionScope.pricer.applicableRateCode}

public class ViewPrices implements Cloneable, Serializable {    
    private static final long serialVersionUID = 1;
    // fields      
    public List<RateCode> applicableRateCode = null;
}

javax.el.PropertyNotFoundException: Property 'applicableRateCode' not found on type com...ViewPrices

${sessionScope.pricer}打印值,但ApplicatableRateCode不会打印


共 (2) 个答案

  1. # 1 楼答案

    您需要将getter方法添加到ViewPrices。JSPEL需要它们

    public class ViewPrices implements Cloneable, Serializable {    
        private static final long serialVersionUID = 1;
        // fields      
        private List<RateCode> applicableRateCode = null;
    
        public List<RateCode> getApplicableRateCode() {
           return applicableRateCode ;
        }
    }
    
  2. # 2 楼答案

    类中缺少Setter/Getter。JSTLEL将使用标准访问器方法访问属性