The icecore:navigationNotifier component will notify the application when the page shown in the browser was rendered as a result of a browser navigation by using 'back' or 'forward' browser buttons.
// MPL License text (see http://www.mozilla.org/MPL/)
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ace="http://www.icefaces.org/icefaces/components"
xmlns:icecore="http://www.icefaces.org/icefaces/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
template="/resources/templates/content-template.xhtml">
<ui:param name="title" value="#{msgs['example.core.navigationNotifier.title']}"/>
<ui:param name="description" value="#{msgs['example.core.navigationNotifier.description']}"/>
<ui:param name="resourceValue" value="#{navigationNotifierBean.exampleResource}"/>
<ui:param name="wikiResources" value="#{navigationNotifierResources.wikiResources}"/>
<ui:param name="tldResources" value="#{navigationNotifierResources.tldResources}"/>
<ui:define name="example">
<h4>Page A</h4>
<a id="link" href="resources/examples/core/navigationNotifier/navigation-notifier-next.jsf" style="border: 1px solid grey;">Navigate
to the other page</a>
<h:form>
<icecore:navigationNotifier action="#{navigationNotifierViewScopeBean.navigationDetectedEvent}"/>
</h:form>
<ace:panel id="result" rendered="#{navigationNotifierViewScopeBean.navigationDetected}">
Back/forward navigation detected!
</ace:panel>
</ui:define>
</ui:composition>
/* MPL License text (see http://www.mozilla.org/MPL/) */
package org.icefaces.samples.showcase.example.core.navigationNotifier;
import org.icefaces.samples.showcase.metadata.annotation.*;
import org.icefaces.samples.showcase.metadata.context.ComponentExampleImpl;
import javax.annotation.PostConstruct;
import javax.faces.bean.CustomScoped;
import javax.faces.bean.ManagedBean;
import java.io.Serializable;
@ComponentExample(
title = "example.core.navigationNotifier.title",
description = "example.core.navigationNotifier.description",
example = "/resources/examples/core/navigationNotifier/navigationNotifier.xhtml"
)
@ExampleResources(
resources ={
// xhtml
@ExampleResource(type = ResourceType.xhtml,
title="navigationNotifier.xhtml",
resource = "/resources/examples/core/navigationNotifier/navigationNotifier.xhtml"),
// Java Source
@ExampleResource(type = ResourceType.java,
title="NavigationNotifierBean.java",
resource = "/WEB-INF/classes/org/icefaces/samples/showcase"+
"/example/core/navigationNotifier/NavigationNotifierBean.java")
}
)
@Menu(
title = "menu.core.navigationNotifier.subMenu.title",
menuLinks = {
@MenuLink(title = "menu.core.navigationNotifier.subMenu.main",
isDefault = true,
exampleBeanName = NavigationNotifierBean.BEAN_NAME)
}
)
@ManagedBean(name = NavigationNotifierBean.BEAN_NAME)
@CustomScoped(value = "#{window}")
public class NavigationNotifierBean extends ComponentExampleImpl<NavigationNotifierBean> implements Serializable {
public static final String BEAN_NAME = "navigationNotifierBean";
public String getBeanName() { return BEAN_NAME; }
public NavigationNotifierBean() {
super(NavigationNotifierBean.class);
}
@PostConstruct
public void initMetaData() {
super.initMetaData();
}
}
© 2013 ICEsoft Technologies Inc.