On 1/26/07, Paul Spencer <[EMAIL PROTECTED]> wrote:
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.
<snip/>
Couldn't spot anything so dropped your code snippets into the
shale-test-dialog-scxml app. Works for me, recipe below:
1) Used SessionManagerBean and the <h:form> snippet, both verbatim
from below (snippet placed at the bottom of wizardpage1.jsp in the
test app above)
2) faces-config additions:
<managed-bean>
<managed-bean-name>sessionManager</managed-bean-name>
<managed-bean-class>org.apache.shale.examples.test.dialog.scxml.SessionManagerBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/*</from-view-id>
<navigation-case>
<from-action>#{sessionManager.gotoHome}</from-action>
<from-outcome>home</from-outcome>
<to-view-id>/menu.jsp</to-view-id>
</navigation-case>
</navigation-rule>
Then clicking on "Home" takes me to the test app home page (menu.jsp)
after stopping the active dialog.
-Rahul
***
* 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