Salesforce 未知属性';String.FirstName';
错误:未知属性“String.FirstName\uu c”Salesforce 未知属性';String.FirstName';,salesforce,visualforce,apex,Salesforce,Visualforce,Apex,错误:未知属性“String.FirstName\uu c” 我正在尝试开发一个简单的注册页面,其中包括名为FirstName、LastName和ContactNumber的三列。 谁能告诉我我在哪里犯了错误 <apex:page Controller="Reg"> <apex:form> <apex:pageBlock title="Registration Edit" mode="edit"> <ap
我正在尝试开发一个简单的注册页面,其中包括名为FirstName、LastName和ContactNumber的三列。 谁能告诉我我在哪里犯了错误
<apex:page Controller="Reg">
<apex:form>
<apex:pageBlock title="Registration Edit" mode="edit">
<apex:pageBlockButtons location="both">
<apex:commandButton value="save" action="{!Save}"/>
<apex:commandButton value="cancel" action="{!Cancel}"/>
<apex:commandButton value="addRow" action="{!addRowMethod}" rerender="anyName"/>
<apex:commandButton value="removeRow" action="{!removeRowMethod}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Information" columns="1">
<apex:inputText value="{!Registration.FirstName__c}"/>
<apex:inputText value="{!Registration.LastName__c}"/>
<apex:inputText value="{!Registration.ContactNumber__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
The controller code
public class Reg {
public String Registration { get; set; }
public PageReference removeRowMethod() {
return null;
}
public PageReference addRowMethod() {
return null;
}
public PageReference Cancel() {
return null;
}
public PageReference Save() {
return null;
}
}
控制器代码
公共类注册{
公共字符串注册{get;set;}
公共页面引用方法(){
返回null;
}
公共页面引用addRowMethod(){
返回null;
}
公共页面引用取消(){
返回null;
}
公共页面引用保存(){
返回null;
}
}
公共字符串注册{get;set;}
-这是一个字符串变量。类似整数或布尔值的“基元”。它没有字段
您可以将其设置为sObject(不知道您在做什么,这些字段是否存在于say standardContact
对象上,或者您是否有自定义的注册\uu c
),例如
或者您可以在类中有三个自由浮动字符串字段,然后在VF页面上引用它们
public String firstName {get;set;}
public String lastName{get;set;}
public String contactNumber {get;set;}
<apex:inputText label="First Name" value="{!firstName}" />
publicstringfirstname{get;set;}
公共字符串lastName{get;set;}
公共字符串contactNumber{get;set;}
public String firstName {get;set;}
public String lastName{get;set;}
public String contactNumber {get;set;}
<apex:inputText label="First Name" value="{!firstName}" />