PrimeFaces CommandButton17 Mar 2025 | 阅读 2 分钟 它是 JSF 标准 h:commandButton 的扩展版本。 它包括 ajax、部分处理和皮肤功能。 <p:commandButton> 组件用于在 JSF 应用程序中创建按钮。 当我们想在 Web 应用程序中执行操作时,它很有用。 此组件具有以下表格中的各种属性。 CommandButton 属性属性 | 默认值 | 类型 | 描述 |
---|
rendered | true | Boolean | 它用于指定组件的渲染。 | 值 | null | String | 它用于设置按钮的标签。 | action | null | MethodExpr/String | 它用于设置单击按钮时的操作。 | actionListener | null | MethodExpr | 它用于设置单击按钮时要处理的 actionlistener。 | type | submit | String | 它设置按钮的行为。 | ajax | true | Boolean | 它指定提交模式。 | async | false | Boolean | 如果设置为 true,则不会对 ajax 请求进行排队。 | process | null | String | 它用于部分处理而不是整个视图。 | update(更新) | null | String | 它用于使用 ajax 更新组件。 | 全局 | true | Boolean | 它定义是否触发 ajaxStatus。 | delay | null | String | 它用于设置延迟值。 | partialSubmit | false | Boolean | 它仅启用属于部分处理组件的值的序列化。 | timeout | 0 | Integer | 它用于设置 ajax 请求的超时时间(以毫秒为单位)。 |
示例在这里,在以下示例中,我们正在实现 <p:commandButton> 组件。 此示例包含以下文件。 JSF 文件// commandButton.xhtml ManagedBean// CommandButton.java 输出 

|