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
Ranadheer chRanadheer ch 

i created basic vf page to display a+b=c ....this is working fine ...but i want to dispaly the values of A,B,C in pageblocktable how can i dispaly like so

i created basic vf page to display a+b=c ....this is working fine ...but i want to dispaly the values of A,B,C in pageblocktable how can i dispaly like so.


while saving the page am getting this error :Unknown property 'Integer.a'

vf page:

<apex:page controller="integercon" >
<apex:form >
Value Of A:<apex:inputText value="{!a}"/>
Value Of B:<apex:inputText value="{!b}"/>
Value Of C<apex:inputText value="{!c}"/>
<apex:commandButton action="{!savelist}" value="click"/>
<apex:pageBlock>
<apex:pageBlockTable value="{!dispaly}" var="r">
<apex:column value="{!r.a}"/>
<apex:column value="{!r.b}"/>
<apex:column value="{!r.c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>


Class:

public with sharing class integercon {
   public integer a{get;set;}
   public integer b{get;set;}
   public integer c{get;set;}
   
   public integer dispaly{get;set;}
    
    
    public void savelist() {
        c=a+b;
        
    }
}


please help me ...with out pageblck table excution is okay...but i want to display the a,b,c values on vf page ...how can i so??

thanks in advance

Best Answer chosen by Ranadheer ch
Anoop yadavAnoop yadav
Hi,
Try with the below Visualforce Page and the your conroller.
<apex:page controller="integercon" >
<apex:form >
Value Of A:<apex:inputText value="{!a}"/>
Value Of B:<apex:inputText value="{!b}"/>
Value Of C<apex:inputText value="{!c}"/>
<apex:commandButton action="{!savelist}" value="click"/>
<apex:pageBlock>
    <apex:pageBlockTable value="{!1}" var="1">
        <apex:column headerValue="Enter A">    
            <apex:inputText value="{!a}"/>
        </apex:column>
        <apex:column headerValue="Enter B">
            <apex:inputText value="{!b}"/>
        </apex:column>
        <apex:column headerValue="SUM of A & B">
            <apex:outputText value="{!c}"/>
        </apex:column>
    </apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>