function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SMGSFDCDEVSMGSFDCDEV 

Visualforce error on custom controller

Can someone please help me wtih this error message on the following Custom Controller:

 

 

Save error: Uknown property 'ProductsController.opp'

 

Here is the custom controller:

 

public class ProductsController {

public List <Opportunity>getProducts(){

List <Opportunity> opp;

opp = [Select Name from Opportunity];

return opp;

}
}

 

 

 

Here is the Visualforce page:

<apex:page controller="ProductsController">

<apex:form >
<apex:dataTable value = "{!opp}" var="prod">
</apex:dataTable>
</apex:form>


</apex:page>

 

 

I am not sure why it is telling me that the opp variable used in the List of my custom controller is an unknown property.

 

Error Message: Save error: Unknown property: 'ProductsController.opp'

VishwanathVishwanath

<apex:dataTable value = "{!Products}" var="prod">

 

Try this

Navatar_DbSupNavatar_DbSup

Hi, below is your modified code, try this one

 

// your Controller

public class ProductsController {

 

public List <Opportunity>getProducts(){

 

List <Opportunity> opp;

 

opp = [Select Name from Opportunity];

 

return opp;

 

}

}

 

 

//VF Page

<apex:page controller="ProductsController">

<apex:form >

<apex:dataTable value = "{!Products}" var="prod">

</apex:dataTable>

</apex:form>

 </apex:page>

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.