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 Unknown property error on Opportunity 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'

 

aballardaballard

Your method is called getProducts, so the expression to access it would be {!products}.   It has no knowledge of the internal variables used in your code....

SMGSFDCDEVSMGSFDCDEV

Awesome! that fixed it!

thanks a lot aballard