0

我正在使用 h:commandLink 进行删除,单击此链接可以启用确认对话框,但是当我单击确定时,它没有删除..我需要再添加吗?请帮助。

<h:commandLink  update="#{cc.attrs.ajaxupdate}" 
onclick="if (! confirm('Are you sure, you want to remove picture?') ) { return 
false;};     return true; ">
<f:ajax listener="#{cc.attrs.deleteactionlistener}"/>
<p:graphicImage value="/resources/images/delete.gif" />
</h:commandLink>
4

2 回答 2

0

您必须将 放在h:commandLink元素h:form中才能提交数据并执行处理程序。onclick另一方面是在没有提交的情况下完成的。

顺便问一下,update属性是干什么用的?至少它不在标准中h:commandLink

于 2013-03-15T06:34:33.907 回答
0

下面是我的使用方法...

<h:commandLink value="Delete" action="#{Bean.delete()}" 
    onclick="return confirm('Are you sure you want to delete?')" />
             ^^^^^^^

在你的情况下,它会是

<h:commandLink  update="#{cc.attrs.ajaxupdate}" 
     onclick="return confirm('Are you sure, you want to remove picture?')">

希望这能解决您的问题。

于 2013-03-15T06:40:16.650 回答