Attributes of h:outputLink
There are several attributes for each tag. The JSF h:outputText tag's features are listed below.
-
id: id for the tag
-
binding: a reference of a backing bean component.
-
rendered: A boolean value where false would suppress the rendering
-
styleClass: Cascading stylesheet (CSS) class name
-
value: a value binding
-
valuechangeListener: a method binding that responds to changes in value
-
converter: class name converter
-
validator: the component's attached validator's class name
-
required: a boolean value where if the value is true, then it marks the tag as required
-
accesskey: gives focus to an element
-
accept: list of content types for a form, separated by commas
-
accept-charset: character encodings for a form, separated by commas or spaces.
-
alt: alternative text for nontextual elements such as images
-
border: The width of an element's border in pixel value
-
charset: Character encoding for a linked resource
-
coords: Coordinates for an element whose shape is a circle, rectangle, or polygon
-
dir: Direction for text. LTR (left to right) and RTL(right to left) are valid values .
-
hreflang: a resource's href attribute-specified base language.
-
lang: The attributes and text of an element's base language
-
maxlength: maximum number of characters for text field
-
readonly: Read-only state of an input field
-
rel: the relationship between the linked page and the current page
-
rev: reverse link the current document to the anchor you gave in the href attribute.
-
style: For the component, it is used to apply CSS.
-
tabindex: numerical value specifying a tab index
-
target: the name of a frame that opens a document
-
title: A title is made for accessibility. Usually, browsers create tooltips for the title's value.
-
type: this is a type of link. Example: stylesheet
-
width: Element's width
-
onblur: losing focus's event handler
-
onchange: Event handler for value changes
-
onclick: Event handler for the element that was clicked with the mouse
-
ondblclick: Event handler for a double-click on a mouse button
-
onfocus: Event handler for elements received focus
-
onkeydown: Event handler for the key pressed
-
onkeypressed: Event handler for the key pressed or released
-
onmousedown: Event handler for mouse button
-
onmousemove: Event handler for mouse moved
-
onmouseout: Event handler for mouse left
-
onmouseover: Event handler for mouse moved onto
-
onmouseup: Event handler for mouse button released
-
onreset: Event handler for form reset
- onselect: Event handler for text select
Example
To test the above-mentioned tag, let's build a test JSF application.

home.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<head>
<title>JSF Tutorial!</title>
</head>
<body>
<h2>h:outputLink example</h2>
<hr />
<h:form>
<h:outputLink value = "Welcome to Coding Ninjas.jsf" >Welcome to Coding Ninjas!</h:outputLink>
</h:form>
</body>
</html>
Output

Frequently Asked Questions
What is the JSF life cycle?
When the client sends an HTTP request for a page to the server, the JavaServer Faces application's lifecycle starts, and it ends when the server returns the page. There are two key stages to the JSF lifecycle: The phase of execution Rendering Stage.
What is meant by JSF?
JSF (Java Server Faces) is a Java-based web application framework designed to make the building of web-based user interfaces more accessible. The Java Community Process codified a definition for JavaServer Faces, a standardized display technology.
What is the prerequisite for running the JSF program?
Java Runtime Environment, JDK, Maven, and Apache tomcat facilitate the running of JSF applications.
Conclusion
This article extensively discussed the topic of JSF h:outputLink in detail. We started with an introduction and discussed the definition of outputLink with some examples. Later, we also discussed the Attributes of h:outputLink with example.
We hope that this blog has helped you enhance your knowledge of the JSF h:outputLink and was helpful for you in your journey towards mastering JSF. If you want to learn more, check out our other articles on the topics like JSF f:attribute, JSF Parameters, JSF Life Cycle, and many more on our platform Coding Ninjas Studio.
For peeps out there who want to learn more about Data Structures, Algorithms, Power programming languages, JavaScript, interview questions, or any other upskilling, please refer to our guided paths on Coding Ninjas Studio. Enroll in our courses, go for mock tests, solve available problems, and interview puzzles. Also, you can focus on interview stuff- interview experiences and an interview bundle for placement preparations.
Do upvote our blog to help other ninjas grow.
Happy Coding!
