How to access Composite Component attribute values in the backing UIComponent?
Asked Answered
V

1

5

We can access the Composite Component attribute values (defiled in the interface section), in the implimentation like #{cc.attrs.attributeName}

How can we access this value in the backing component?

Voucher answered 31/7, 2011 at 10:10 Comment(0)
P
7

It's just available inside any of the methods by the inherited getAttributes() method which returns a Map<String, Object> with the attribute name as map key and attribute value as map value.

Bar bar = (Bar) getAttributes().get("bar");
// ...
Packsaddle answered 1/8, 2011 at 0:44 Comment(4)
I want to access the attribute of the Composite Component in the backing bean of that Composite Component itself. The backing bean will use the attribute for implementing the Composite Component. (I hope you described above how to access the attribute of the Composite Component in the backing bean of the page which uses the Composite Component)Voucher
So, you're talking about the backing UIComponent? That's not a backing bean... Just call the inherited getAttributes() method. See also our composite component wiki page: stackoverflow.com/tags/composite-component/infoPacksaddle
This is exactly what I have been looking for. The link you gave is also very useful. Thanks a lot BalusC.Voucher
You're welcome. I've updated your question and my answer accordingly to reflect what you really meant and what you really need.Packsaddle

© 2022 - 2024 — McMap. All rights reserved.