The user interface in a Visualforce base can display dynamic content the value of which keeps changing based on user responses. But there are times when we need some content which should not change with the change in values of other components in the page. For example, an image file may be required to remain constant. Such content which cannot be changed in a page is known as a static resource.
Following are a few static resources in Salesforce −
The steps to create a static resource are as below.
Go to Develop → Static resource and mention the values for name, description and file location for the static resource.
Click Save in the above screen to get the file attached to the User Interface controller.
Next we create the apex code as in the following screenshot to reference the static object we created above.
Running the above apex code will generate the following output. The output shows a static resource.