This section illustrates you about the JSF commandLink tag which is rendered as a anchor tag. And this tag behaves as a command button for the form submission and this tag is also used for the event handling purposes through the backing bean. This tag has text that can be labeled by some external resources like properties file from the message bundle.
Here, you will see more about the commandLink tag of JSF how is it used in JSF programming. There is a program with the complete code of JSF has been given for understanding the procedure of using the tag.
Here, when your run the above program, output will be seen like the following image in which the text "Go for list of examples." is looking like a hypertext. This is not only a anchor tag. This link behaves like a command button. You can perform an action at the specific event.
When you run the above example, your JSF tags are converted in to HTML code that is given. Following html source code is for the above written JSF code.
HTML Source Code:
<html> <head><title>jsf h:commandLink example</title></head> <body> <form id="_id0" method="post" action="/h-tags/pages/commandLink/ commandLink.jsf" enctype="application/x-www-form-urlencoded"> <a href="#" onclick="document.forms['_id0']['_id0:_idcl'] .value='_id0:_id1'; document.forms['_id0'].submit(); return false;">Go for list of examples.</a> <input type="hidden" name="_id0" value="_id0" /><input type="hidden" name="_id0:_idcl" /> </form> </body> </html>
This JSF tag has some attributes these explained as follows:
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial