문제

I want to assign a static resource image based on a pick list selection to . Any idea how do I do that using apex class. I was able to achieve this using a javascript function but then I have a requirement to render this page as PDF which doesn't support javascript.

Any ideas/pointers ????

도움이 되었습니까?

해결책

Use Apex:variable to assign image path dynamically.

Here is a sample code.

public class TestStaticResource{

public string ImagePath{
    get;set;
}
public TestStaticResource(){
    ImagePath='images/yourImage.png';
}

}

 <apex:form>
      <apex:variable var="var" value="{!ImagePath}"/> 
      <apex:image url="{!URLFOR($Resource.StaticResuorceName, var)}"/> 
 </apex:form>

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top