Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: JSF label doesn't render Date: Wed, 20 Apr 2011 09:00:43 -0400 Organization: albasani.net Lines: 72 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net tifzi4dMd2F4kE5zSyaovAvPHBDloSAI+Qfp6lagxc0bu3+0ALvQJy53gDYii687CEnq0WkGNxD4NtkvcWzwYKQyb2c7HwyNKAP8LTwIVVbnsyjv8shxoUm1HTBvY1cl NNTP-Posting-Date: Wed, 20 Apr 2011 13:00:40 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="IFNsFXXRBa+F0fM18iQBAJtf46sVDdt20anFRuw2et17DdF95EK+1yUwJPn6HqEj33ZPF3O0tEmp7FEHacQ3aLkHyhRIYGEwr00DOAFHWyIu3ACTvRI1CSsYW/i+JU2C"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 In-Reply-To: Cancel-Lock: sha1:dwiVD+YdtL1YMxVuM4DDMXhelEo= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3160 Travers Naran wrote: >> Hi all, I've got a weird problem with JSF rendering. For some reason, >> the label attribute doesn't want to render on the resulting HTML output. >> For example, if I have this: >> >> > id="fname" >> required="true" /> >> >> That label, "First Name", never shows up on the HTML. I checked the HTML >> source too and it's not there, so it's not a browser problem per se. You should read the tutorial, you should read the taglib docs, and you should read the other JSF docs on this tag. That would illuminate your error. RTFM. (Links provided in this post.) > Unless this is something new in JSF 2, there is no "label" attribute on > inputText. In JSF 1.2, you do something like this: Nope. According to there is, too, a "label" attribute for 'h:inputText'. It is described as a "localized user presentable name for this component". However, it is NOT the same as an HTML 'label' tag, nor a JSF 'h:outputLabel' tag. There's no reason to expect to see it in the HTML at all whatsoever, which is why the OP does not see it. The Java EE 6 tutorial at presents the 'h:inputText' tag with a "label" attribute in the very first example: >> > value="#{cashier.name}" >> required="true" >> requiredMessage="#{customMessages.CustomerName}"> >> > type="com.sun.bookstore6.listeners.NameChanged" /> >> >> >> >> The label attribute specifies a user-friendly name that will be used in the >> substitution parameters of error messages displayed for this component. This description, however, does not match the OP's intended use. Maybe he should read the tutorial and other JSF docs? For example: describes the "label" attribute of 'h:inputText' as "A localized user presentable name for this component". There's nothing there to imply anything emitted in HTML for it. Contrast with how the tutorial describes the 'h:outputLabel' tag: "The h:outputLabel tag is used to attach a label to a specified input field for the purpose of making it accessible." > > This will provide his intended use. Note that in HTML, "label" is not an attribute of the 'input' tag, but a separate tag in its own right. There is no "label" attribute in HTML for the 'input' tag. So, bottom line: The 'h:inputText' attribute "label" is not intended to generate any HTML, that's why you don't see it. RTFM. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg