Checking for navigation rule
Hi everybody. Is there an easy way for an action method to check for the existence of a navigation rule before returning the outcome String? I know that the normal functionality is that, if you return an outcome that does not match to an existing navigation rule, the same view will be shown again. But I'd like to check for that nav rule before returning from the action method so I can go do something else instead of just showing the same page again. I've done something like the following, but this doesn't seem to be the most efficient since I'd be creating the ViewRoot once in handleNavigation() and then again when I return the outcome. public String actionMethod() { String outcome = someOutcome; UIViewRoot oldView = facesContext.getViewRoot(); facesContext.getApplication().getNavigationHandler().handleNavigation( facesContext, null, outcome ); if( facesContext.getViewRoot() == oldRoot ) { // No nav rule found, do something else... outcome = getOutcomeFromElsewhere(); } return outcome; } Any alternatives? Thanks... Dave The information transmitted herewith is sensitive information of Chordiant Software or its customers and is intended only for use to the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon, this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.
Re: Checking for navigation rule
Even though you would have to cast it, I believe these methods are now public on the NavigationHandlerImpl of myfaces On 8/31/07, David Brunette [EMAIL PROTECTED] wrote: Hi everybody. Is there an easy way for an action method to check for the existence of a navigation rule before returning the outcome String? I know that the normal functionality is that, if you return an outcome that does not match to an existing navigation rule, the same view will be shown again. But I'd like to check for that nav rule before returning from the action method so I can go do something else instead of just showing the same page again. I've done something like the following, but this doesn't seem to be the most efficient since I'd be creating the ViewRoot once in handleNavigation() and then again when I return the outcome. public String actionMethod() { String outcome = someOutcome; UIViewRoot oldView = facesContext.getViewRoot(); facesContext.getApplication().getNavigationHandler().handleNavigation( facesContext, null, outcome ); if( facesContext.getViewRoot() == oldRoot ) { // No nav rule found, do something else… outcome = getOutcomeFromElsewhere(); } return outcome; } Any alternatives? Thanks… Dave The information transmitted herewith is sensitive information of Chordiant Software or its customers and is intended only for use to the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon, this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.
Re: Checking for navigation rule
This is complete guesswork, but what about extending navigationHandler and installing a custom navigation handler? You could then make the default behavior of your navigation handler to get outcomes from somewhere else, perhaps by setting navigationHandler.setFallBackOutcomeCallback(Method method), or perhaps caching the ViewRoot if you query for whether there's an outcome and reusing it on the real invocation. On 8/31/07, David Brunette [EMAIL PROTECTED] wrote: Hi everybody. Is there an easy way for an action method to check for the existence of a navigation rule before returning the outcome String? I know that the normal functionality is that, if you return an outcome that does not match to an existing navigation rule, the same view will be shown again. But I'd like to check for that nav rule before returning from the action method so I can go do something else instead of just showing the same page again. I've done something like the following, but this doesn't seem to be the most efficient since I'd be creating the ViewRoot once in handleNavigation() and then again when I return the outcome. public String actionMethod() { String outcome = someOutcome; UIViewRoot oldView = facesContext.getViewRoot(); facesContext.getApplication().getNavigationHandler().handleNavigation( facesContext, null, outcome ); if( facesContext.getViewRoot() == oldRoot ) { // No nav rule found, do something else… outcome = getOutcomeFromElsewhere(); } return outcome; } Any alternatives? Thanks… Dave The information transmitted herewith is sensitive information of Chordiant Software or its customers and is intended only for use to the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon, this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.
RE: Checking for navigation rule
It seems as though I'd be looking at having my own extended NavigationHandler. I was hoping to avoid that... didn't know if there was something else out there that I was just missing. Thanks guys. Dave -Original Message- From: Mike Kienenberger [mailto:[EMAIL PROTECTED] Sent: Friday, August 31, 2007 11:31 AM To: MyFaces Discussion Subject: Re: Checking for navigation rule This is complete guesswork, but what about extending navigationHandler and installing a custom navigation handler? You could then make the default behavior of your navigation handler to get outcomes from somewhere else, perhaps by setting navigationHandler.setFallBackOutcomeCallback(Method method), or perhaps caching the ViewRoot if you query for whether there's an outcome and reusing it on the real invocation. On 8/31/07, David Brunette [EMAIL PROTECTED] wrote: Hi everybody. Is there an easy way for an action method to check for the existence of a navigation rule before returning the outcome String? I know that the normal functionality is that, if you return an outcome that does not match to an existing navigation rule, the same view will be shown again. But I'd like to check for that nav rule before returning from the action method so I can go do something else instead of just showing the same page again. I've done something like the following, but this doesn't seem to be the most efficient since I'd be creating the ViewRoot once in handleNavigation() and then again when I return the outcome. public String actionMethod() { String outcome = someOutcome; UIViewRoot oldView = facesContext.getViewRoot(); facesContext.getApplication().getNavigationHandler().handleNavigation( facesContext, null, outcome ); if( facesContext.getViewRoot() == oldRoot ) { // No nav rule found, do something else... outcome = getOutcomeFromElsewhere(); } return outcome; } Any alternatives? Thanks... Dave The information transmitted herewith is sensitive information of Chordiant Software or its customers and is intended only for use to the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon, this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer. The information transmitted herewith is sensitive information of Chordiant Software or its customers and is intended only for use to the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon, this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.