Rerender and actionsupport - A simple example

8:45 AM

What 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:sectionHeader title="Rerender Example"/>
<apex:commandButton value="Move your mouse here to refresh the time!">
<apex:actionSupport event="onmouseover" rerender="time" status="refreshstatus"/>
<apex:actionStatus id="refreshstatus" startstyle="color:green;" startText="Refreshing...."></apex:actionStatus>
<apex:outputpanel id="time">
<apex:outputtext value="{!NOW()}"/>

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...


  1. 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..

    thnx kaushik ray

  2. thanks It really clear the rerender ..

  3. thanks for this Example
    its very nice

  4. really good explanation for rerender

  5. love ur blog! very useful!