This is the outputLabel tag which show the text labeled with the specific component created in your application. This is tag is used under the specific JSF html tag for creating a component because the outputLabel tag is only used for a component.
<%@ page contentType="text/html" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <f:view> <html> <head><title>jsf h:outputLabel example</title></head> <body> <h:inputText id="name"> <h:outputLabel for="name" value="Enter your name: "/> </h:inputText> </body> </html> </f:view>
Above code creates a output label having text "Enter your name: " for a text box as you see in the following output image.
Following code is the browser generated html code regarding the above used JSF code of the program.
HTML Source Code:
<html> <head><title>jsf h:outputLabel example</title></head> <body> <label for="name">Enter your name: </label> <input id="name" type="text" name="name" /> </body> </html>
All attributes of the JSF HTML outputLabel tag are explained as follows:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.