Rahul,
I an getting the following when I click on the home link.  It appears that the 
dialog
is still running even though it was stopped.

***
* Stack Trace
***

ServletRequestAttributeAdded(org.apache.myfaces.config.beansUnderConstruction,[])
stop(id=1, name=addVendor)
remove(Removed DialogContext instance with ID '1'
handleNavigation(context='[EMAIL PROTECTED]', 
fromAction='#{sessionManager.gotoHome}', outcome='home')
Dialog instance '1' for dialog name 'addVendor' has not yet been started
java.lang.IllegalStateException: Dialog instance '1' for dialog name 
'addVendor' has not yet been started
        at 
org.apache.shale.dialog.scxml.SCXMLDialogContext.advance(SCXMLDialogContext.java:316)
        at 
org.apache.shale.dialog.faces.DialogNavigationHandler.handleNavigation(DialogNavigationHandler.java:139)
        at 
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:84)
        at 
org.apache.shale.view.faces.ViewActionListener.processAction(ViewActionListener.java:74)
        at javax.faces.component.UICommand.broadcast(UICommand.java:106)
        at 
javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
        at 
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
        at 
org.apache.shale.view.faces.ShaleViewRoot.processApplication(ShaleViewRoot.java:40)
        at 
org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
        at 
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)

***
* From the managed bean
***
public class SessionManagerBean
{
    public String gotoHome()
    {
        stopActiveDialogIfAny(FacesContext.getCurrentInstance());
        return "home";
    }

    private void stopActiveDialogIfAny(FacesContext facesContext)
    {
        DialogContext dcontext = (DialogContext) 
facesContext.getExternalContext().getRequestMap().get(Constants.CONTEXT_BEAN);
        if (dcontext != null)
        {
            dcontext.stop(facesContext);
        }
    }
}

**
* Form the view
***
<h:form id="logoutForm">
        <h:commandLink action="#{sessionManager.gotoHome}">
                <h:outputText value="Home" />
        </h:commandLink>
</h:form>


Paul Spencer

Rahul Akolkar wrote:
On 1/26/07, Paul Spencer <[EMAIL PROTECTED]> wrote:
Rahul Akolkar wrote:
<snip/>
>
> As mentioned above, that would be inside the method called by the MB,
> if at all we wanted to stop an active dialog and delegate to the
> faces-config navigation.
>

What is the name of the method, or where do I configure it, that is
called when the outcome, does is not configured?

In the above example page's header/footer define the outcomes "home",
"logout", and "menu".  These outcomes are currently handled by
faces-config.xml, and I agree with your statement about avoiding the
modeling of "global" site navigation in each dialog.

<snap/>

Lets say outcome "home" is actually a commandLink, so simplistically:

<h:commandLink action="home" value="Home" />

This, by itself, would mess with an active dialog. Instead:

<h:commandLink action="#{globals.home}" value="Home" />

would ensure that we clean up correctly if there is an active dialog, where:

// In the managed bean "globals" --

public String home() {

 stopActiveDialogIfAny(); // the two lines of code from before

 return "home";  // faces-config nav rules takes over here
}

Similarly for "logout" and "menu". Also may want to check with user
via onclick or suitable event handlers before wiping out the dialog.

-Rahul


Reply via email to