java af:setPropertyListener不工作,正在调用(nor f:setPropertyActionListener)
有一个带有ADF的基本JSF项目,它需要从表中删除一行(每一行都是一个Album
),并且在请求的行旁边有一个删除按钮(每一行都有一个)
使用JDeveloper尝试使用ADF(使用简单的JSF:(How can I pass selected row to commandLink inside dataTable?)也尝试了这个解决方案)
然而,在我看来,setPropertyListener
和setPropertyActionListener
没有调用(在setCommon()
函数中放置一些虚拟注释,没有看到,也没有显示来自del_action()
的漂亮注释)。还尝试了@SessionScoped
bean
主要问题:哪怕是传递的值也不起作用,这到底出了什么问题
任何想法都将受到高度赞赏(遗憾的是缺少语法亮点,仍然是新手,还没有弄明白它):)
JSF部分:
<af:column sortable="false" headerText=" " align="start" id="c4">
<h:commandButton value="Delete" id="del" action="#{backing_main.del_action}">
<af:setPropertyListener to="#{backing_main.common}" from="#{row.albumName}" type="action" />
</h:commandButton>
</af:column>
支持Bean:
@ManagedBean(name="backing_main") @ViewScoped ... private String common; public void setCommon(String common){ System.out.print("!!!SET!!!!!"); this.common = common; } public String getCommon(){ return this.common; } public void del_action() { System.out.print("!!!!!!!!!!!!!!!!Delete1"); } public static class Album{ String artist; String albumName; //constructor, setter, all the expected stuff }
# 1 楼答案
最好使用ADF组件来获得预期的结果:
af:commandButton
,而不是h:commmandButton
如果不使用taskflow删除行,那么最好切换到
actionListener
,而不是action