About Salesforce.com?

Unknown | 20:41 | 0 comments



In our previous post we have studied about cloud computing and its advantages. Today am going to Show perfect example for cloud platform!
Salesforce.com
                Salesforce.com platform is a world’s first Plat form as service (PaaS).enabling developers to develop and deploy any kind of business application in the cloud.
Technologies behind salesforce.com platform Application:

Multitenant Architecture: An application model in which all users and apps share a single, common infrastructure and code base.

Web services API: An application programming interface that defines a Web service that   provides direct access to all the data stored in the servers.

Apex: The world’s first on-demand programming language, which runs in the cloud on Force.com servers.

Visual force: A framework for creating feature-rich user interfaces for apps in the cloud

Apex is based on Java, and Visual force is a similar to HTML we can also add style sheet to the visual force page!

Simple Calculator application with force.com:
Steps:
1. Create developer accountat Developerforce.com (It is a free account for learning).
2.  Create app follow bellow steps
            2.1. Click the Your Name Setup link in the top-right corner of the page (
             2.2. Go to the App Setup area on the left side of the page.
             2.3. Click the + icon to expand the Create menu, or just click the Create link.
            2. 4. Click the Apps link.
             2.5. Click New. The New Custom App wizard appears.
             2.6. In the App Label field, enter Calculator
3. Next is Develop Apex and Visual Force page for our application
4. Create new Apex class Add bellow code to it
            public class Sample 
{    
    public Double val1 {get;set;}
    public Double val2 {get;set;}
    public Double result {get;set;}
    public String func {get;set;}
    
    public Sample()
    {
    }
    
    public void find()
    {
        if(func == 'add')
        {
            result = val1 + val2;
        }
        else if(func == 'sub')
        {
             result = val1 - val2;
        }
        else if(func == 'div')
        {
             result = val1 / val2;
        }
        
    }
   
}
5. Create new Visual force page and add bellow code to the page.
<apex:page controller="Sample"&gt;

<apex:form >
   
    <apex:pageBlock &gt
;
        <ape
x:pageBlockSection >
            <apex:pageBlockSectionIt
em
&
g
t
;
  
  
   
   
   
<apex:outputLabel value="Value 1"/>
            </apex:page
Bl
oc
k
Sec
tionItem>
  
   
   
    <apex:pageBlockSectionItem >
                <apex:inputText value="{!val1}"/>
            </apex:pageBlockSectionItem&gt;                          
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Value
2"/
&g
t;
          
</a
pex
:pageBlockSectionItem>
            <apex:pageBlockSectionItem &gt
;
     
           &lt
;apex:
inputText value="{!val2}"/>
            &lt;/apex:pageBlockSectionItem>                
         
           &lt;apex:pageBlockSectionItem >
                <apex:selectRadio value="{!func}" layout="pageDirection">
                    <apex:selectOption itemValue="add" itemLabel="Add"/>
                    <apex:selectOption itemValue="sub" itemLabel="Subtract"/>
                    <apex:selectOption itemValue="div" itemLabel="Division"/>
                    <apex:selectOption itemValue="mod" itemLabel="Mod
ulo Di
vision"/>
  
      
        </apex:selectR
adio&g
t
;
   
       
</a
pex:pa
geBloc
kSectionItem>
    
        <apex:pageBlockSectionItem >               
            </apex:pageBlockSectionItem>      
 
       
     <ap
ex:pageBl
ockSectionItem >
                <apex:outputLabel value="Result"/>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:inputText value="{!result}" id="res"/><apex:actionStatus id="sts" startText="Finding..."/>
            </apex:pageBlockSectionItem>                                      
        </apex:pageBlockSection>   
        <apex:pageBlockButtons >
            <apex:commandButton value="Find" action="{!find}" reRender="res"  status="sts"/>
        </apex:pageBlockButtons>
    </apex:pageBlock>
   
</apex:form>

</apex:page>
                          
6. Save and Run your Visual force page at url location that’s it u did simple calc app
7. Happy coding!
                       

                                   

Category: , ,

handsonbook.blogspot.com

0 comments