我想当我点击一个
<p:commandButton>
,调用一个Bean进行处理,同时将页面重定向到另一个页面。
换句话说,我想结合:
<p:commandButton actionListener="#{processBean.process}" >
</p:commandButton>
和:
<h:link outcome="redirection">
</h:link>
其中“重定向”在faces-config.xml中配置
我该怎么办? 有没有更好的方法来实现这一目标?
最佳答案
使用 p:commandButton 的
action
属性。
<p:commandButton actionListener="#{processBean.process}" >
</p:commandButton>
改成
<p:commandButton actionListener="#{processBean.process}" action="viewIDToRedirect" >
</p:commandButton>
首先,将调用 actionListener
,然后启动导航。但请记住,您需要在 faces-config.xml
关于java - primefaces:同时进行 actionListener 和重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21782427/