I am trying to preview an apex:image in a visualforce page, which is going to be specified among this apex variable and taken from the static resources.
Here is my code
public sObject Object_A {set; get;}
Object_A = [SELECT Icon__c, ........];
Visualforce code
<apex:image url="{!URLFOR($Resource.Apex_Icons,'{!Object_A.Icon__c}.png')}"/>
But in this way I cant't get what is Object_A.Icon__c
contains, instead of that I got an image that's named {!Object_A.Icon__c}.png
Attribution to: hasan.alkhatib
Possible Suggestion/Solution #1
You are already in a Visualforce expression because of the outer url="{! ... }"
so should able to use simple string concatenation:
<apex:image url="{! URLFOR($Resource.Apex_Icons, Object_A.Icon__c + '.png') }"/>
Attribution to: Keith C
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/31349