Search code examples
jsfbreadcrumbs

JSF Dynamic Breadcrumbs Between Projects


This may be a bit confusing but I will try to be clear.

I have three projects. One is a registry system which stores information shared between the two applications.

Using Application 1 and Application 2 you can access the registry which is supposed to have a bread crumb back to the specific applications home page.

So far what I have is a bean which can determine which app is active and returns the appropriate url for a page requested. Problem is my UI does not accept the url.

<ui:define name="breadcrumbContent">
    <h:form id="headerForm">
        <ol class="breadcrumb">
            <li><h:link value="#{i18n.recordList}" immediate="true"
                    outcome="#{breadCrumbNavigator.navigatingPage}">
                    <f:param name="pageToGoTo" value="faces/produceManager/index.xhtml"></f:param>
                </h:link></li>
            <li><h:link value="#{i18n.businessRegistry}" immediate="true"
                    outcome="#{breadCrumbNavigator.navigatingPage}">
                </h:link></li>
        </ol>
    </h:form>
</ui:define>

This gives me the two errors

This link is disabled because a navigation case could not be matched.
enter code here

Unable to find matching navigation case from view ID '/produceManager/list.xhtml' for outcome '/ss/faces/index.xhtml'

In the bean I have the URL hard coded. I have tried this with and without the 'localhost:9080' prefix. I am kind of lost on this one. Anyone else do anything like this with breadcrumbs?


Solution

  • Turned out to be really easy!

    All I had to do was define a navigation case in the faces config and use command links.

    <ui:define name="breadcrumbContent">
        <h:form id="headerForm">
            <ol class="breadcrumb">
                <li><h:commandLink value="#{i18n.recordList}" immediate="true"
                        action="#{breadCrumbNavigator.getNavigatingPage}">
                        <f:param name="pageToGoTo" value="goToDashboard"></f:param>
                    </h:commandLink></li>
                <li><h:commandLink value="#{i18n.businessRegistry}" immediate="true"
                        actions="#{breadCrumbNavigator.navigatingPage}">
                        <f:param name="pageToGoTo" value="goToProducerManager"></f:param>
                    </h:commandLink></li>
            </ol>
        </h:form>
    </ui:define>