Create Simple Interest Program using Visual Force and APEX Controller | APEX, VISUALFORCE INTEGRATION:
It is most important concept to create Controller in APEX and use into visual force Pages.
Step to Create Controller First
public class SIController {
public Decimal p{get;set;}
public Decimal r{get;set;}
public Decimal t{get;set;}
public Decimal result{get;set;}
public void calc()
{
result = (p*r*t)/100;
}
}
Code of VisualForce Page:
<apex:page controller="SIController">
<apex:pageBlock title="si">
<apex:pageBlockSection>
<apex:form>
<apex:inputText value="{!p}" label="Enter p" /> <br/><br/>
<apex:inputText value="{!r}" label="Enter r" /><br/><br/>
<apex:inputText value="{!t}" label="Enter t" /><br/><br/>
<apex:commandButton value="Calculate" action="{!calc}" />
</apex:form>
</apex:pageBlockSection>
<apex:pageBlockSection>
<apex:outputText value="{!result}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
0 Comments
POST Answer of Questions and ASK to Doubt