Rerender and actionsupport - A simple example
8:45 AMWhat is the purpose of Rerender??
Rerender is used when you want to refresh only a portion of your visualforce page when the user does some action... This would actually improve the user interface and reduce processing time....
In this article we will go through a simple example which demonstrates the usage of these two attributes..
A small program:
Create a visualforce page with the following code...
<apex:page >
<apex:form>
<apex:pageBlock>
<apex:sectionHeader title="Rerender Example"/>
<apex:commandButton value="Move your mouse here to refresh the time!">
<apex:actionSupport event="onmouseover" rerender="time" status="refreshstatus"/>
</apex:commandButton>
<apex:actionStatus id="refreshstatus" startstyle="color:green;" startText="Refreshing...."></apex:actionStatus>
<apex:outputpanel id="time">
<apex:outputtext value="{!NOW()}"/>
</apex:outputpanel>
</apex:pageBlock>
</apex:form>
</apex:page>
Save the page and move your mouse across the button to see the results....
Understanding the code:
We will now analyze the code..
<apex:actionSupport event="onmouseover" rerender="time" status="refreshstatus"/>
The event attribute determines which action should refresh the page, we have a onmouseover. That's why when you move the mouse over the command button, the time gets refreshed..
The rerender attribute determines the portion of the page to be refreshed. We have "time" which is the ID of the portion to be refreshed....
The actionstatus attribute determines the status message to be displayed when the refresh takes place. We have "refreshstatus" which is the ID of the associated "actionstatus" tag...
5 comments
thanx..its really difficult getting started with apex codes..plz if u have any link that can tell the basics of apex..plz post it..
ReplyDeletethnx kaushik ray
thanks It really clear the rerender ..
ReplyDeletethanks for this Example
ReplyDeleteits very nice
really good explanation for rerender
ReplyDeletelove ur blog! very useful!
ReplyDelete