myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Andraschko <andraschko.tho...@gmail.com>
Subject Check if attribute is set on a UIComponent instance
Date Wed, 26 Mar 2014 19:41:59 GMT
Hi,

i currently try to develop a small addon to extract maxlength/required from
the BV annotations via a PostAddToViewEvent listener.

e.g.

@Max(5) @Min(1) private String test;
h:inputText value="#{bean.test}"

should automatically set maxlength to 5 and required to true.

Now, my problem is, how do i check if the attribute is really defined?
It's not enough to check "component.isRequired()" as the user could
manually set required=false in the facelets.

I already tried via:
component.getAttributes
component.getValueExpression
or even
component.getStateHelper.get

but it's always null.

AFAICS the info is only available in the StateHelper impl in a fullStateMap
or similiar.

Is there a spec conform way to check if the attribute is defined?

Thanks!

Regards,
Thomas

Mime
View raw message