[英]Primefaces CommandButton not working inside DataTable
I have a primefaces commandButton outside of a data table which functions properly.我在数据表之外有一个功能正常的primefaces commandButton。 Inside a dataTable, I have the exact same commandButton, but when the one inside the dataTable is clicked, it doesn't call the actionListener:
在数据表中,我有完全相同的 commandButton,但是当点击数据表中的那个时,它不会调用 actionListener:
<h:body>
<h:form>
<p:messages autoUpdate="true" showDetail="true" closable="true"/>
<p:accordionPanel >
<p:tab title="Visualize data">
<p:commandButton value="Add Domain" actionListener="#{TripleStoreController.addDomain('Domain')}"
update="DomainSkillTable"/>
<p:dataTable
id="DomainSkillTable"
var="result"
value="#{TripleStoreController.domainResults}"
rowKey="#{result}">
<p:column>
#{result}
</p:column>
<p:column>
<p:commandButton value="Add Domain" actionListener="#{TripleStoreController.addDomain('Domain')}"
update="DomainSkillTable"/>
</p:column>
</p:dataTable>
</p:tab>
</p:accordionPanel>
</h:form>
</h:body>
it should be work.它应该是工作。 there is no error, i had just copy and and make back bean for the same method
TripleStoreController.addDomain('Domain')
in my java class the method signature like public void addDomain(String s)
and method worked.没有错误,我只是在我的 java 类中为相同的方法
TripleStoreController.addDomain('Domain')
复制并重新生成 bean,方法签名如public void addDomain(String s)
和方法有效。 even i got the value pass by command button as 'Domain' in my back bean.甚至我在我的后台 bean 中通过命令按钮将值传递为“域”。
就我而言,我只是将我的 bean 从 @RequestScoped 制作为 @ViewScoped,它解决了我的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.