Reference a VisualForce component attribute to use in itself

apexvisualforcevisualforce-component

I would like to know how to get an attribute of a component in a visualForce code.

In this code, wrappers is a map and I would like to put the value of the pageBlocktable to a List which is contained in my map, it is accessible by the key "cable".
Unfortunately, when I try to hardcode the value I want in the get function with a string, I have an error.

I have tried to replace what is is the circle pointed by the arrow with :

Cable
"Cable"
'Cable'
\"Cable\"
\'Cable\'

But none of them seem function, so I tried to get it by putting in a title and acces it later.

I also dont think it is possible to use the apex:param to set the variable of my controller and reference it.

Can someone help me getting the right synthax or tell me how to achieve what I am trying to do?

thanks

visualForce code

Best Answer

You can't reference a component's attributes that way in Visualforce. You can only reference public Apex variables and methods, and Visualforce variables (e.g. from apex:pageBlockTable or apex:variable). As an aside, you only use ! at the beginning of a merge field, and you don't use .get on a Map, but just the ordinary map[key] notation. {wrappers[test.title]} would have been the appropriate way to reference the value, if it were allowed.