You need to sign in to do that
Don't have an account?
Francisco Garcia 34
How can I pass the a number obtained in Apex and display it in Visualforce?
I need to pass a number from my Apex Class into my visualforce page.
This is my Apex Class:
This is my Visualforce page:
This is my Apex Class:
public class controllerClass { Public Case myCase {get; set;} public List<Case> cases {get; set;} List<Case> openedCases = [SELECT AccountId, Status, Subject FROM Case WHERE IsClosed = False ORDER BY AccountId DESC]; Public controllerClass(ApexPages.StandardController stdController){ this.myCase = (Case)stdController.getRecord(); this.cases = openedCases; } //This is the integer I want to pass into visualforce Integer temp = openedCases.size(); }
This is my Visualforce page:
<apex:page standardController="Case" extensions="controllerClass"> <apex:pageBlock title="Table of Open Cases"> <apex:pageBlockTable value="{!Cases}" var="c"> <apex:column value="{!c.AccountId}"/> <apex:column value="{!c.Status}"/> <apex:column value="{!c.Subject}"/> </apex:pageBlockTable> </apex:pageBlock> <!-- Variable should go below--> <apex:variable var="" value="" /> <p>The number from apex is <!-- Apex Number -->.</p> </apex:page>
Instead of that integer you can directly get the size like above.
If you want to use integer number then:
Use this temp in page.
All Answers
Instead of that integer you can directly get the size like above.
If you want to use integer number then:
Use this temp in page.
If you need hardcoded value in you vf page then assign value in constructor.Try like below code If you need dynamic then @Nayana K is right.
Please mark it solved.
Thanks
Hemant