Salesforce 在Vf页中使用类列表时出现未知属性
我有一节课Salesforce 在Vf页中使用类列表时出现未知属性,salesforce,visualforce,Salesforce,Visualforce,我有一节课 public with sharing class CAccountRep { string sageAccountNo {get;set;} string clientName {get;set;} string name {get;set;} integer noofdays {get;set;} string billableUnits {get;set;} decimal dailyChargeRate {get;set;} string nominalCode {get;s
public with sharing class CAccountRep {
string sageAccountNo {get;set;}
string clientName {get;set;}
string name {get;set;}
integer noofdays {get;set;}
string billableUnits {get;set;}
decimal dailyChargeRate {get;set;}
string nominalCode {get;set;}
string practice {get;set;}
string taxFlag {get;set;}
string ProjectId {get;set;}
string PONumber {get;set;}
public CAccountRep(String CrSageAc,String CrClientN,string CrName,integer Crnoofdays,string crbillableunits,decimal CrDecimalChargeRate,string crNominalCode,string CrPractice, String CrTaxFlag,String CrProjectId, String CrPONumber)
{
sageAccountNo=CrSageAc;
clientName=CrClientN;
name=CrName;
noofdays=Crnoofdays;
billableUnits=crbillableunits;
dailyChargeRate=CrDecimalChargeRate;
nominalCode=crNominalCode;
practice=CrPractice;
taxFlag=CrTaxFlag;
ProjectId=CrProjectId;
PONumber=CrPONumber;
}
}
我正在创建这个类的对象,并将参数传递给这个类
public List<CAccountRep> AR { get;set; }
public list<CAccountRep> getAR()
{
if(AR!= null)
return AR ;
else return null;
}
Using the follwing code to create the object of the class
CAccountRep CRep=new CAccountRep(projectList[0].Sage_Account_Number__c,projectList[0].Client_Name__c, Cname,enoOfBillableDays,projectList[0].BillableUnits__c,AssConlist[0].Daily_Charge_Rate_of_Consultant__c,AssConlist[0].Nominal_Code__c,projectList[0].C85_Practice__c,projectList[0].Tax_Flag__c,projectList[0].Project_ID__c,projectList[0].PO_Number__c);
AR.add(CRep);
关于如何正确显示它,有什么想法吗?我认为编译器会感到困惑,因为它认为有两个公众人物,即这两行:
public List<CAccountRep> AR { get;} // just removed set; for now
public list<CAccountRep> getAR()
尝试这样做:
public List<CAccountRep> AR { get{
return AR ; // if AR is null it returns null so the if statement was redundant
}set; }
我按照您的建议删除了两个getter方法,并按照您的建议添加了get和set。。我仍然会犯同样的错误…哦,天哪…我不敢相信我错过了公共修饰符。。谢谢
public List<CAccountRep> AR { get;} // just removed set; for now
public list<CAccountRep> getAR()
{!AR}
public List<CAccountRep> AR { get{
return AR ; // if AR is null it returns null so the if statement was redundant
}set; }
public string ProjectId {get;set;}