【发布时间】:2019-05-15 08:17:46
【问题描述】:
我有一个 HtmlDatatable
- 一个命令按钮可以编辑。
- 一个命令按钮保存。
- 一个 InputText 来显示信息。
<h:form>
<h:dataTable var="entity" value="#{bean.entities}">
<h:column>
<f:facet name="header">ColumnA</f:facet>
<h:commandButton value="edit" actionListenner="#{bean.edit()}" />
<hcommandButton value="save" actionListenner="#{bean.save(entity)} rendered="false"/>
<h:inputText value="#{entity.value}"/>
</h:column>
</h:dataTable>
</h:form>
我希望当我单击 CommandButton 编辑时出现 CommandButton 保存。如何从 bean 访问我的方法 edit() 中的命令按钮保存?
- 唯一的方法是从按钮传递 clientId。
- 或者是否有另一种方法,将对象本身作为 EL 的参数传递并直接在方法中使用它? #{bean.edit(buttonSave)}
public void edit()
{
//TODO get the button save from the same row as the button triggered.
//TODO switch rendered to true.
}
【问题讨论】:
-
了解 ajax...
标签: jsf