This is the outputLink which show the output text holding a link of a page or a website location. This link is similar from the link created by the JSF commandLink tag text. But the main difference between the commandLink tag and the outputLink tag is as follows:
The outputLink tag is used for the direct navigation from the current page to another page or a website while the commandLink tag is also used for passing values to the faces-config.xml file to navigate another page of your application by specifying the location of the page in faces-config.xml file. Code for the outputLink has been given as follows:
Code Description:
<%@ page contentType="text/html" %> |
Above code will display a hypertext with the link of the anotherpage.jsp that exists in the same directory. Here, you will see the mentioned file has ".jsf" extension because the value of the url-pattern attribute is *.jsf like <url-patter>*.jsf</url-pattern> in the web.xml file as you can see. If you mention the file name with the jsf extension for the jsp page, controller understand itself by reading the value of the url-pattern attribute of the web.xml file.
Rendered Result:

HTML Source Code:
<html> <head><title>jsf h:outputLink example</title></head> <body> <a href="anotherpage.jsf">Go for another page.</a> </body> </html> |
All attributes of the outputLink tag are explained below:
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.
Ask Questions? Discuss: JSF outputLink Tag View All Comments
Post your Comment