jsf 2 - What is difference in JSF between component.getAttributeName() vs. component.getAttributes().get("name") -
what difference in jsf between
uicomponent component; component.get *attributename*() , component.getattributes().get("attibute name")
?
component.set *attributename*(value) component.getattributes().put("attibute name", value)
?
make difference if example set disabled=true
attribute in invoke phase in getattributes()
hashmap ?
functionally, doesn't make difference. technically, uicomponent#getattributes()
allows developer not worry exact component type while getting/setting attributes.
look @ particular example disabled="true"
. uicomponent
superclass doesn't have isdisabled()
method @ all. you'd need perform instanceof
check on e.g. htmlinputtext
before can cast , invoke isdisabled()
on it. getattributes()
easier in order independent that. lot of uicomponent
related methods in standard jsf api take or return uicomponent
superclass instead of specific type.
in designed components, both delegate under covers same, uicomponent#getstatehelper()
.
Comments
Post a Comment