【发布时间】:2012-04-05 16:53:31
【问题描述】:
我在 backing bean 中调用一个函数,但是在渲染 jsf 页面之前,我需要进行一些操作,这些操作取决于将要渲染的 jsf 页面(此页面从一个调用更改为另一个)。
我需要在渲染页面之前截取url的名称,因为我需要执行操作并将结果存储在会话中。
所以我想使用 PhaseListener 来获取 URL,而不是导航案例的名称。
例如:函数 'execute' 返回 'ivIndex' 但我需要获取 '/zone/iv/index.xhtml' .
我该怎么做?
方法:
public String execute(){
return nameUrl(); // return name of a navigation rule, per example : ivIndex
faces-config.xml
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>ivIndex</from-outcome>
<to-view-id>/zone/iv/index.xhtml</to-view-id>
</navigation-case>
【问题讨论】:
标签: jsf-2 phaselistener