primefaces_Primefaces CommandLink

primefaces

Today we will look into Primefaces CommandLink component. Primefaces CommandLink extends standard JSF commandLink with Ajax capabilities.

今天,我们将研究Primefaces CommandLink组件。 Primefaces CommandLink扩展了具有Ajax功能的标准JSF commandLink。

Primefaces CommandLink (Primefaces CommandLink)

Below table contains some of the basic information of Primefaces CommandLink component.

下表包含Primefaces CommandLink组件的一些基本信息。

TagcommandLink
Component Classorg.primefaces.component.commandlink.CommandLink
Component Typeorg.primefaces.component.CommandLink
Component Familyorg.primefaces.component
Renderer Typeorg.primefaces.component.CommandLinkRenderer
Renderer Classorg.primefaces.component. commandlink.CommandLinkRenderer
标签 命令链接
组件类别 org.primefaces.component.commandlink.CommandLink
组件类型 org.primefaces.component.CommandLink
组件族 org.primefaces.component
渲染器类型 org.primefaces.component.CommandLinkRenderer
渲染器类 org.primefaces.component。 commandlink.CommandLinkRenderer

Primefaces CommandLink属性 (Primefaces CommandLink Attributes)

NameDefaultTypeDescription
idnullStringUnique identifier of the component
renderedtrueBooleanBoolean value to specify the rendering of the component, when set to false component will not be rendered.
bindingnullObjectAn el expression that maps to a server side UIComponent instance in a backing bean
valuenullStringHref value of the rendered anchor.
actionnullMethodExpr/ StringA method expression or a String outcome that’d be processed when link is clicked.
actionListenernullMethodExprAn actionlistener that’d be processed when link is clicked.
immediatefalseBooleanBoolean value that determines the phaseId, when true actions are processed at apply_request_values, when false at invoke_application phase.
asyncfalseBooleanWhen set to true, ajax requests are not queued.
processnullStringComponent(s) to process partially instead of whole view.
ajaxtrueBooleanSpecifies the submit mode, when set to true(default), submit would be made with Ajax.
updatenullStringComponent(s) to be updated with ajax.
onstartnullStringClient side callback to execute before ajax request is begins.
oncompletenullStringClient side callback to execute when ajax request is completed.
onsuccessnullStringClient side callback to execute when ajax request succeeds.
onerrornullStringClient side callback to execute when ajax request fails.
globaltrueBooleanDefines whether to trigger ajaxStatus or not.
delaynullStringIf less than delay milliseconds elapses between calls to request() only the most recent one is sent and all other requests are discarded. If this option is not specified, or if the value of delay is the literal string ‘none’ without the quotes, no delay is used.
partialSubmitfalseBooleanEnables serialization of values belonging to the partially processed components only.
resetValuesfalseBooleanIf true, local values of input components to be updated within the ajax request would be reset.
ignoreAutoUpdatefalseBooleanIf true, components which autoUpdate=”true” will not be updated for this request. If not specified, or the value is false, no such indication is made.
stylenullStringStyle to be applied on the anchor element
styleClassnullStringStyleClass to be applied on the anchor element
onblurnullStringClient side callback to execute when link loses focus.
onclicknullStringClient side callback to execute when link is clicked.
ondblclicknullStringClient side callback to execute when link is double clicked.
onfocusnullStringClient side callback to execute when link receives focus.
onkeydownnullStringClient side callback to execute when a key is pressed down over link.
onkeypressnullStringClient side callback to execute when a key is pressed and released over link.
onkeyupnullStringClient side callback to execute when a key is released over link.
onmousedownnullStringClient side callback to execute when a pointer button is pressed down over link.
onmousemovenullStringClient side callback to execute when a pointer button is moved within link.
onmouseoutnullStringClient side callback to execute when a pointer button is moved away from link.
onmouseovernullStringClient side callback to execute when a pointer button is moved onto link.
onmouseupnullStringClient side callback to execute when a pointer button is released over link.
accesskeynullStringAccess key that when pressed transfers focus to the link.
charsetnullStringCharacter encoding of the resource designated by this hyperlink.
coordsnullStringPosition and shape of the hot spot on the screen for client use in image maps.
dirnullStringDirection indication for text that does not inherit directionality. Valid values are LTR and RTL.
disablednullBooleanDisables the link
hreflangnullStringLanguae code of the resource designated by the link.
relnullStringRelationship from the current document to the anchor specified by the link, values are provided by a space-separated list of link types.
revnullStringA reverse link from the anchor specified by this link to the current document, values are provided by a space-separated list of link types.
shapenullStringShape of hot spot on the screen, valid values are default, rect, circle and poly.
tabindexnullIntegerPosition of the button element in the tabbing order.
targetnullStringName of a frame where the resource targeted by this link will be displayed.
titlenullStringAdvisory tooltip information.
typenullStringType of resource referenced by the link.
名称 默认 类型 描述
ID 空值 组件的唯一标识符
呈现 真正 布尔型 布尔值,用于指定组件的呈现,当设置为false时将不呈现组件。
捆绑 空值 目的 El表达式,它映射到支持Bean中的服务器端UIComponent实例
空值 渲染锚点的Href值。
行动 空值 MethodExpr /字符串 单击链接时将处理的方法表达式或字符串结果。
actionListener 空值 方法专家 单击链接时将要处理的动作监听器。
即时 布尔型 当在apply_request_values处理为真时,在invoke_application阶段为false时,确定phaseId的布尔值。
异步的 布尔型 设置为true时,ajax请求不会排队。
处理 空值 要部分处理而不是整个视图的组件。
阿贾克斯 真正 布尔型 指定提交模式,当设置为true(默认)时,将使用Ajax进行提交。
更新 空值 用ajax更新的组件。
启动时 空值 在ajax请求开始之前执行的客户端回调。
未完成 空值 在ajax请求完成时执行的客户端回调。
成功 空值 在ajax请求成功时执行的客户端回调。
错误 空值 在ajax请求失败时执行的客户端回调。
全球 真正 布尔型 定义是否触发ajaxStatus。
延迟 空值 如果两次对request()的调用之间的延迟时间少于毫秒,则只会发送最近的一次,而所有其他请求都将被丢弃。 如果未指定此选项,或者delay的值是不带引号的文字字符串“ none”,则不使用延迟。
部分提交 布尔型 启用仅属于部分处理的组件的值的序列化。
resetValues 布尔型 如果为true,则将重置ajax请求中要更新的输入组件的本地值。
ignoreAutoUpdate 布尔型 如果为true,则不会为此请求更新autoUpdate =“ true”的组件。 如果未指定,或者值为false,则不会进行任何指示。
样式 空值 应用于锚元素的样式
styleClass 空值 要应用于锚元素的StyleClass
Onblur 空值 当链接失去焦点时执行客户端回调。
点击 空值 单击链接时执行的客户端回调。
ondblclick 空值 双击链接时执行客户端回调。
专注 空值 当链接获得焦点时执行客户端回调。
按键 空值 在链接上按下键时执行客户端回调。
按键 空值 按下并通过链接释放键时执行的客户端回调。
按键 空值 通过链接释放键时执行的客户端回调。
鼠标停下 空值 在链接上按下指针按钮时执行客户端回调。
情绪激动 空值 当指针按钮在链接内移动时执行客户端回调。
暂停 空值 当指针按钮从链接移开时执行客户端回调。
鼠标悬停 空值 当指针按钮移到链接上时执行客户端回调。
鼠标悬停 空值 通过链接释放指针按钮时执行的客户端回调。
快捷键 空值 按下访问键会将焦点转移到链接。
字符集 空值 此超链接指定的资源的字符编码。
座标 空值 屏幕上热点的位置和形状,供客户在图像地图中使用。
目录 空值 不继承方向性的文本的方向指示。 有效值为LTR和RTL。
残障人士 空值 布尔型 禁用链接
hreflang 空值 链接指定的资源的语言代码。
rel 空值 从当前文档到链接指定的锚点的关系,值由链接类型的空格分隔的列表提供。
转速 空值 从此链接指定的锚点到当前文档的反向链接,值由空格分隔的链接类型列表提供。
形状 空值 屏幕上热点的形状,有效值为默认值,矩形,圆形和多边形。
标签索引 空值 整数 按钮元素在制表顺序中的位置。
目标 空值 将显示此链接目标资源的框架的名称。
标题 空值 咨询工具提示信息。
类型 空值 链接引用的资源类型。

Primefaces CommandLink示例 (Primefaces CommandLink Example)

Primefaces CommandLink is similar to JSF h:commandLink except that the form is submitted with ajax by default.

Primefaces CommandLink与JSF h:commandLink相似,除了默认情况下使用ajax提交表单。

simpleCommandLink.xhtml

simpleCommandLink.xhtml

<html xmlns="https://www.w3.org/1999/xhtml"
	xmlns:ui="https://java.sun.com/jsf/facelets"
	xmlns:h="https://java.sun.com/jsf/html"
	xmlns:f="https://java.sun.com/jsf/core"
	xmlns:p="https://primefaces.org/ui">
<h:head>
	<script name="jquery/jquery.js" library="primefaces"></script>
</h:head>
<h:form>
	<p:commandLink value="Do Action" action="#{commandLinkManagedBean.doSomeAction}"></p:commandLink>
</h:form>
</html>
package com.journaldev.primefaces.beans;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class CommandLinkManagedBean {
	public String doSomeAction(){
		System.out.println("CommandLink is used");
		return "";
	}
}

Below image shows the console output when you click on the Primefaces CommandLink link multiple times.

下图显示了多次单击Primefaces CommandLink链接时的控制台输出。

That’s all for a quick roundup on Primefaces CommandLink component. You can download the Primefaces CommandLink example project from below link.

这就是对Primefaces CommandLink组件的快速总结。 您可以从下面的链接下载Primefaces CommandLink示例项目。

翻译自: https://www.journaldev.com/12150/primefaces-commandlink

primefaces

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值