Javatpoint Logo
Javatpoint Logo

PrimeFaces CommandLink

It is an extended version of JSF h:commandLink with Ajax, partial processing and confirmation feature. It is used to create a link which redirects control to specified target.

The <p:commandLink> component is used to create a link in JSF application. It has various attributes that are tabled below.

CommandLink Attributes

Attribute Default value Type Description
id null String Unique identifier of the component
value null String Href value of the rendered anchor.
action null MethodExpr/ String A method expression or a String outcome that'd be processed when link is clicked.
async false Boolean When set to true, ajax requests are not queued.
process null String Component(s) to process partially instead of whole view.
ajax true Boolean Specifies the submit mode, when set to true(default), submit would be made with Ajax.
update null String Component(s) to be updated with ajax.
global true Boolean Defines whether to trigger ajaxStatus or not.
resetValues false Boolean If true, local values of input components to be updated within the ajax request would be reset.
timeout 0 Integer Timeout for the ajax request in milliseconds.
type null String Type of resource referenced by the link.
form null String Form to serialize for an ajax request. Default is the enclosing form.

Example

Here, in the following example, we are implementing <p:commandLink> component. This example contains the following files.

JSF File

// commandLink.xhtml

ManagedBean

// CommandLink.java

Output:

PrimeFaces CommandLink 1
PrimeFaces CommandLink 2




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA