Just to complicate things, you could actually implement chaining, but
it is more work.

1) Write a custom NavigationHandler
2) create some kind of "magic" syntax for chaining
3) Check in the NavigationHandler for the specified syntax
4) Invoke additional actions from the custom navigation handler

Something like this should work (BTW - I didn't check that this
compiles, I typed it from memory):

public class ChainingNavigationHandler
 extends NavigationHandlerImpl
{
 public final static String CHAIN_PREFIX = "chain-action:";

 @Override
 public void handleNavigation(FacesContext context, String fromAction,
   String outcome)
 {
   if (outcome != null && outcome.startsWith(CHAIN_PREFIX))
   {
     String newAction = "#{" + outcome.substring(CHAIN_PREFIX.length()) + "}";
     MethodBinding mb =
context.getApplication().createMethodBinding(newAction);
     Object result = mb.invoke();
     outcome = (result == null) ? null : result.toString();
     fromAction = newAction;
   }
   super.handleNavigation(context, fromAction, outcome);
 }
}

Then, from your action:
return ChainingNavigationHandler.CHAIN_PREFIX + "myBean.nextAction";


-Andrew

On 11/30/06, Jeff Bischoff <[EMAIL PROTECTED]> wrote:
Yes, do what Andrew said. The code pattern will look something like:

public String firstAction() {
   MyBean secondBean = getMySecondBean();
   if(someCondition) {
     return secondBean.secondAction();
   }
}

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

Andrew Robinson wrote:
> Just call the action method of another bean from the action method
> invoked by the UICommand componen.
>
> On 11/29/06, Amit Kushwaha <[EMAIL PROTECTED]> wrote:
>> Hi.
>>
>> Is there a action chaining like functionality for managed beans?  For
>> ex, I'd like the result of a managed bean invoke a method in another
>> managed bean which takes the user to a view.
>>
>> I have tried, to-action-id but that didn't work. Am dealing with pre JSF
>> 1.2.
>>
>> TIA.
>>
>> Regards.
>>
>> Amit
>>
>>
>>
>
>
>



Reply via email to