[SalesForce] Display controller variable on VF page. How

I am trying to show 3 consecutive "blocks/span", 2 are variables, 3rd is a button.

Links to : 1. the element 2. the controller

WITH the last button element, the page DOES NOT save, the error given is :

Error: Could not resolve the entity from <apex:outputField> value binding '{!totalGoodBC}'. <apex:outputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.

WITHOUT the button, the page SAVES, the error is :

value for <apex:outputField> is not a dynamic binding

What is going on here?

Best Answer

In this scenario, you should use <apex:outputText> instead of <apex:outputField>.

<apex:outputText value="{!totalGoodBC}" styleClass="slds-input"/>

<apex:outputField>is used to bind values which are of Sobject type. Or in other words, instance of Sobject class.

Related Topic