Easy learning with example program codes

Jsf outputlink html tag

JSF h:outputLink tag is used to render HTML anchor element. Value attribute specify the target URL.

JSF tag:

<h:outputLink  value="nextPage">Click Here</h:outputLink>

Rendered HTML tag:

<a href="nextPage.xhtml">Click Here</a>

1. The “h:link” tag is useful to generate a link which requires to interact with the JSF “outcome” , but lack of “action” support make it hard to generate a dynamic outcome.
2. The “h:commandLink” tag is suck, the generated JavaScript is really scary! Not recommend to use this tag, unless you have a solid reason to support. But it supports the “action” attribute, which is what “h:link” lack of.
3. The “h:outputLink” is useful to generate a link which does not require to interact with the JSF program itself.

Attributes of h:outputlink tag.

idid for the tag
bindingReference to the component used in a backing bean
renderedA boolean value; false would suppress rendering
styleClassCascading stylesheet (CSS) class name
valuevalue binding
valueChangeListenerA method binding that responds to value changes
converterConverter class name
validatorClass name of a validator attached to the component
requiredA boolean; if true, marks the tag as required
accesskeygives focus to an element
acceptComma-separated list of content types for a form
accept-charsetComma- or space-separated list of character encodings for a form.
altAlternative text for nontextual elements such as images
borderPixel value for an element’s border width
charsetCharacter encoding for a linked resource
coordsCoordinates for an element whose shape is a rectangle, circle, or polygon
dirDirection for text. Valid values are ltr (left to right) and rtl (right to left).
hreflangBase language of a resource specified with the href attribute;
langBase language of an element’s attributes and text
maxlengthMaximum number of characters for text fields
readonlyRead-only state of an input field
relRelationship between the current page and linked page
revReverse link from the anchor specified with href to the current document.
styleInline style information
tabindexNumerical value specifying a tab index
targetThe name of a frame in which a document is opened
titleA title used for accessibility. Browsers typically create tooltips for the title’s value
typeType of a link; for example, stylesheet
widthWidth of an element
onblurEvent handler for losing focus
onchangeEvent handler for value changes
onclickEvent handler for Mouse button clicked over the element
ondblclickEvent handler for Mouse button double-clicked
onfocusEvent handler for element received focus
onkeydownEvent handler for Key pressed
onkeypressEvent handler for Key pressed and released
onkeyupEvent handler for Key released
onmousedownEvent handler for Mouse button pressed
onmousemoveEvent handler for mouse moved
onmouseoutEvent handler for mouse left
onmouseoverEvent handler for mouse moved onto
onmouseupEvent handler for mouse button released
onresetEvent handler for form reset
onselectEvent handler for Text selected



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<html xmlns=""
		<title>JSF output link example.</title> 
      <h3>JSF output link example.</h3>
         <h:outputLink  value="welcome.xhtml">Say Hello</h:outputLink>


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<html xmlns=""
		<title>JSF output link example.</title>
      <h3>Hello World.</h3>


<?xml version="1.0" encoding="windows-1252"?>
<faces-config version="2.0" 


<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 




JSF example18-1
Click on Say Hello link.
JSF example18-2
Download this example.

Please follow and like us:
Posted in JSF   

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki