On running the following code in apex and visualforce respectively i am receiving following error:
Error: Unknown property 'Setter_Method.Oportunities'
Quick Fix Create Apex property 'Setter_Method.Oportunities'
Quick Fix Create Apex method 'Setter_Method.getOportunities'
Apex Code:
public class Setter_Method {
public String n;
List<opportunity> op;
public String getSearch(){//to return the search query again
return n;
}
public List<Opportunity> getResult(){//to return the search results
return op;
}
public void setOportunities(String s){//to set the search from VF to apex
n=s;
}
public PageReference display(){
op =[SELECT Amount,Name,TotalOpportunityQuantity,probability from Opportunity WHERE name =:'n'];
return null;
}
}
Visual Force code:
<apex:page controller="Setter_Method">
<apex:form >
<apex:pageBlock >
<apex:inputText value="{!Oportunities}"/>
<apex:commandButton action="{!display}" value="Search Name"/>
<apex:pageBlockTable value="{!Result}" var="op">
<apex:column value="{!op.name}"/>
<apex:column value="{!op.Amount}"/>
<apex:column value="{!op.TotalOpportunityQuantity}"/>
<apex:column value="{!op.probability }"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Please explain the logic of getter, setter and the attribute of <apex:inputText value"">