我想点击一下
<p:commandButton>
Run Code Online (Sandbox Code Playgroud)
,调用用于处理的Bean,同时应将页面重定向到另一个页面.
换句话说,我想结合:
<p:commandButton actionListener="#{processBean.process}" >
</p:commandButton>
Run Code Online (Sandbox Code Playgroud)
和:
<h:link outcome="redirection">
</h:link>
Run Code Online (Sandbox Code Playgroud)
在faces-config.xml中配置"重定向"
我应该怎么做 ?有没有更好的方法来实现这一目标?
使用action
属性p:commandButton.
<p:commandButton actionListener="#{processBean.process}" >
</p:commandButton>
Run Code Online (Sandbox Code Playgroud)
将其更改为
<p:commandButton actionListener="#{processBean.process}" action="viewIDToRedirect" >
</p:commandButton>
Run Code Online (Sandbox Code Playgroud)
首先,actionListener
将被调用,然后导航将启动。但请记住,您需要在中定义导航规则faces-config.xml