Hi have a List<String> Key and a map<String, String> mapkv

VF Page:

<apex:page applyHtmlTag="false" controller="testController" extensions="otherclass1" action="{!someFunction}"> 

<c:test lstkey="{!lstkey}" mapkv="{!mapkv}" /> 



Public static List<String> Key {get;set;}
Public static map<String, String> mapkv {get;set;}
//Controller class is something like:
for(String s:lstStr){

now on my component

I am passing the attribute as

<apex:attribute type="map" name="mapkv" description="Navigation HTML code" required="true" />
<apex:attribute type="String[]" name="lstkey" description="Navigation HTML code" />

and inside the component I want to use the map like:

<apex:repeat value="{!lstkey}" var="key" >
     <apex:repeat value="{!mapkv[key]}" var="item">
          <a href="{!item}"><span> {!key}</span></a>      

but I am getting an error saying Syntax error: Found mapkv.

Please help me resolve this. How can I get the map value in the component so that it can be set as the href.

  • How are you provided value for mapkv and lstkey attributes in the component?
    – Rao
    Sep 29, 2015 at 17:12
  • yes, I am passing the value to the component when its called from the page like: <apex:page applyHtmlTag="false" controller="testController" extensions="otherclass1" action="{!someFunction}"> <c:test lstkey="{!lstkey}" mapkv="{!mapkv}" /> </apex:page>
    – SFDC_MJ
    Sep 29, 2015 at 17:15
  • can you post your VF page along with the apex:page tag?
    – Rao
    Sep 29, 2015 at 17:16

2 Answers 2


Looking at the provided Component and Controller markup, I believe you are getting the error because you trying to iterate over a string value. Looking at this

< apex:repeat value="{!mapkv[key]}" var="item" >

Mapkv[key] will give you a string value and you cannot iterate over a string. Your code should be something like.

<apex:repeat value="{!lstkey}" var="key" > 
<a href="{!mapkv[key]}"><span> {!key}</span></a>
  • how is your code any different than <a href="{!key}">{!key}</a> , I do not see any error with the way the op has structured his code
    – Rao
    Sep 29, 2015 at 17:48
  • This code is correct. There is no need for two <apex:repeat tags. The repeat over lstkey gets the key as key. The href retrieves the value from the map using key and the span is around the key itself.
    – Mark Pond
    Sep 29, 2015 at 17:51
  • i just saw what the op did he was looping the key inside his second repeat. this answer is the right way to go :)
    – Rao
    Sep 29, 2015 at 18:03
  • Yes rao, I agree with you however, this is a specific solution for the syntax error OP is recieving. I believe if OP was passing lstkey instead if key, he would have received a different error Ex. No such property controllername.lstkey , probably its an error while posting.
    – manjit5190
    Sep 29, 2015 at 18:03
  • @manjit_singh : I tried the above code as well, and getting the same error.
    – SFDC_MJ
    Sep 30, 2015 at 10:45

Check your component's API version. The API version must be greater that 19 to use Visualforce dynamic binding.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .