Posts

Showing posts from May, 2017

Visualforce Componets

Image
Code reuse is one of the best practice in coding.  We reuse code while writing code in Apex by creating functions and calling it wherever required, but how to reuse code when it comes to Visualforce? Well the answer is   Visualforce Component . We can create Visualforce Component , pass parameters to it and use it wherever required. Visualforce Component may or may not have a controller. Component Syntax: <apex:component > <apex:attribute name="ComponentAttributeName" type="String" required="true"/> <apex:outputText   value="{! ComponentAttributeName }"/> <apex:component > Attribute type can be String, Integer, Boolean,  sObject, List or Class                 Syntax to use Component : <c:componentName ComponentAttributeName="Value"/> Visualforce Component can be used in Visualforce page or other Visualforce Component. Let’s implement an application and use Visualforce Compon