【发布时间】:2012-08-23 23:08:39
【问题描述】:
有什么方法可以在执行navigation rule 时执行一些代码。基本上我想做的是拥有一个JourneyTracker bean,它将保存旅程的当前状态(就像用户所在的当前页面一样)。
【问题讨论】:
标签: jsf navigation jsf-1.2 journey
有什么方法可以在执行navigation rule 时执行一些代码。基本上我想做的是拥有一个JourneyTracker bean,它将保存旅程的当前状态(就像用户所在的当前页面一样)。
【问题讨论】:
标签: jsf navigation jsf-1.2 journey
您可以为此使用自定义NavigationHandler。基本上,只需将抽象类扩展如下:
public class MyNavigationHandler extends NavigationHandler {
private NavigationHandler wrapped;
public MyNavigationHandler(NavigationHandler wrapped) {
this.wrapped = wrapped;
}
@Override
public void handleNavigation(FacesContext context, String from, String outcome) {
// Do your job here. Just check if "from" and/or "outcome" matches the desired rule.
wrapped.handleNavigation(context, from, outcome); // Important! This will perform the actual navigation.
}
}
要让它运行,只需在faces-config.xml注册如下:
<application>
<navigation-handler>com.example.MyNavigationHandler</navigation-handler>
</application>
【讨论】:
fromAction 和outcome 手动/以编程方式执行NavigationHandler 的导航,如FacesContext.getCurrentInstance().getApplication().getNavigationHandler() 获得的那样。
@Annotation 无需编辑即可使用faces-config.xml?
service jboss.deployment.unit."project-web-1.0.war".component."org.jboss.weld.servlet.WeldInitialListener".START (no longer required) 这样的消息,并且一些链接附加了像This link is disabled because a navigation case could not be matched. 这样的消息?