What is the purpose of the label attribute in a JSF Command button?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Very well spotted. It has really no meaningful purpose on a
<h:commandButton>.This attribute is supposed to be present in
UIInputcomponents such as<h:inputText>only. It’s then exactly that value which will then be used in the first message format placeholder{0}of validation/conversion messages so that it shows up like so with e.g.label="Username":If the
labelattribute is omitted, it would default to the component’s client ID which is often less friendly readable towards the enduser with autogenerated IDs and:separator and so on like soThis attribute was introduced in JSF 1.2. I think that the mistake of the JSF developer/implementer was to specify the new attrubute for JSF components which generate HTML
<input>,<select>and<textarea>elements, not specifically on JSF compnents which extend fromUIInput. This attribute is namely (correctly) absent on<h:commandLink>which belongs to the sameUICommandfamily as<h:commandButton>.I’ve reported it as issue 2365.