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
jedi_101jedi_101 

Display query value

Hi,

I have a controller class called myController with a variable defined as integer and a method doCount which captures the count of records in the variable t3. How do I display this t3 value in my page editor? I have a submit button in the page which calls for the doCount method. But I dont know how to display the value in the page. Could someone help.

public class myController {

Integer t3;

public Integer getCountLeads() { return t3; }

public integer doCount() {
t3= [select count() from lead ];
return t3;
}
}

Page editor code
<apex:form>
<apex:commandButton value="Submit" action="{!doCount}"></apex:commandButton>
</apex:form>


Steve ChadbournSteve Chadbourn

By using rerender something like this:

<apex:form>
<apex:commandButton value="Submit" action="{!doCount}" rerender="resultsOut"></apex:commandButton>

<apex:outputText id="resultsOut" value="{!countLeads}"/>
</apex:form>