i have a pageblock section that appears multiple times on my visualforce page.Hence for optimizing the code, I thought to take that out of my visualforce page and place it as a apex:component instead wherever necessary.
However, t doing so, I'm facing a challenge on how to access some variables that controlls the logic of required={!variable1} or rendered={!variable2} from inside the apex:component as this two variables are get/set from my controller extension class and can be accessed from the visualforce page directly but not sure on how to access the same from visualforce component too. Any idea on that will be highly appreciated.
Below is the mock up code that I want to use--
**Page**
<apex:page standardController="ObjectAPIName" extension="className">
<apex:pageBlockSection columns="2">
<apex:outputField value="{!o.field1}" required="{!variable1}" rendered="{!variable3}"/>
<apex:outputField value="{!o.field2}" required="{!variable2}" rendered="{!variable4}"/>
</apex:pageBlockSection>
</apex:page>
**Class**
public Class className{
public variable1 {get;set};
public variable2 {get;set};
.....
}
My components field visibility is also dependent on the variables used in controller.
Thanks