reRender:
用途:局部刷新
這個屬性的value值是組件的ID,可以是一個或多個ID,多個ID用','隔開。
rendered:
用途:可以控制一個控件是頁面上是否能顯示出來。
這個屬性的value是一個Boolean值。如果是true,控件會在頁面上顯示,否則,不會在頁面上顯示。
reRender與rendered的聯合使用:
不能在一個控件中,寫reRender和rendered兩個屬性。要把控件顯示不顯示的控件放在局部刷新的控件裏面。
eg:
<apex:form >
<apex:pageBlock title="Condition">
<apex:pageBlockSection columns="2">
<apex:outputPanel title="Account">
<apex:outputLabel value="Account: "></apex:outputLabel>
<apex:selectList value="{!optionAcc}" size="1" style="width:230px">
<apex:selectOptions value="{!optionAccList}"></apex:selectOptions>
<apex:actionSupport event="onchange" action="{!searchAccOppList}" reRender="oppId, contentId"/>
</apex:selectList>
</apex:outputPanel>
<apex:outputpanel title="Opportunity" id="oppId">
<apex:outputLabel value="Opportunity: "></apex:outputLabel>
<apex:selectList value="{!optionOpp}" size="1" style="width:230px">
<apex:selectOptions value="{!optionOppList}"></apex:selectOptions>
<apex:actionSupport event="onchange" action="{!searchOppContentList}" reRender="contentId"/>
</apex:selectList>
</apex:outputpanel>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:outputPanel id="contentId">
<apex:pageBlock title="Content" rendered="{!showContentVersion}">
......