+ Start a Discussion
Marco ZeuliMarco Zeuli 

Visualforce Dynamic Binding Map values

Hi guys!

Today i need your help with an issue I'm facing at work...

I hve the following custom controller:
 

public with sharing myCustomController {

	public Map<String, wrapperObj> myMap {
	    get {
	        // populate map...
	    set;
	}

	// methods and stuffs...

	public class wrapperObj {
	    public String label;

	    public wrapperObj() {}
	}

}

And this VF page related to my custom controller
 
<apex:page controller="myCustomController">
<apex:form id="myForm">
    <apex:pageBlock >
            <!-- Map values -->
            <apex:repeat value="{!myMap}" var="key">                                    
                // this works fine
                <apex:outputText value="{!key}" />
                // this works too
                <apex:outputText value="{!myMap[key]}" />
                // this not !!
                <apex:outputText value="{!myMap[key].label}" />

            </apex:repeat>
    </apex:pageBlock>
</apex:form>

Basically I cannot figureout how to bind the wrapper object values on the page. Tryng to render the page I get this error:
 
Unknown property 'myCustomCotroller.wrapperObj.label'
Error is in expression '{!myMap[key].label}' in component <apex:outputText> in page

Thanks for your help in advance!! :)
Best Answer chosen by Marco Zeuli
Marco ZeuliMarco Zeuli
I solve the problem :D
It was so obvious... 
I need to put getter/setter property also on wrapperObj like this
public class wrapperObj {
	    public String label {get;set;}

	    public wrapperObj() {}
	}