[英]JSF Primefaces Datatable ActionLink problems
Prerequisites: 先决条件:
User Story: 用户的故事:
I want to implement a delete row function on my Primefaces DataTable, the Delete Function has to be displayed within the table. 我想在Primefaces DataTable上实现删除行功能,删除功能必须显示在表中。
Implementation: 实现方式:
datatable header 数据表头
<p:dataTable value="#{a.list}" var="var">
delete 删除
<p:column headerText="Delete">
<p:commandLink value="-" action="#{a.delete(var)}" />
</p:column>
delete method in bean bean中的删除方法
public void delete(Something sth) {
model.getList().remove(sth);
}
Outcome: 结果:
When hovering over the commandLink its showing me this Uniform Resource Locator localhost/applicationname/# 悬停在commandLink上时,向我显示此统一资源定位符localhost / applicationname /#
Eclipse is giving me the Facelet Validator Warning Marker Syntax Error on this ExpressionLanguage Code #{a.delete(var)}
Eclipse给我此ExpressionLanguage Code
#{a.delete(var)}
上的Facelet验证器警告标记语法错误
Question: 题:
What am i missing in order to delete the row? 为了删除该行,我缺少什么?
Solution: 解:
I have changed to commandlink from JSF (not primefaces) and got the Error, that my method shouldnt be void, but String after changing that and returning null it works... 我已经从JSF更改为commandlink(不是primefaces)并得到了错误,我的方法不应为空,但是在更改并返回null之后,String可以工作...
public String delete(Something sth) {
model.getList().remove(sth); return null;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.