Hi daniel ,
You can use viewcontroler( http://shale.apache.org/shale-view/index.html ) to achieve this kind of functionality.

In the init method of the *view controller* perform the check(user in session) and navigate to the login page using

init()
{
    if(userInSession){
       do the load of the controls
    }else{
       
FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation();
    }
}



Cheers,
David Brainard Sounthiraraj.


daniel ccss wrote:
I have a simple question

I have been working with myfaces-tomahawk for 6 months, great, but I
have a question, how to call an 'action' from the backing bean, until
today I have called all my action methods from the JSP page, on the
onClick, onChange, etc events, but now I need to call an action from
another method in my backing bean.

I have an init method in my backing bean that ask if the user is in
session, if yes all the load of the combos etc is make, if not I need
to call a method that returns to the login page by returning the
navigation rule like this:

//init
{
     if(userInSession){
        do the load of the controls
     }else{
        returnToLogin();
     }
}

private String returnToLogin(){
      return "login";
}

and in faces-config.xml i have the navigation rule:

<navigation-rule>
  <from-view-id>....

  <navigation-case>
   <from-outcome>login</from-outcome>
   <to-view-id>/JSP/Login.jsp</to-view-id>
  </navigation-case>
....

But nothing happens, this type of call can be done?, or only I can
call an action that returns to a navigation rule from the JSP, if so,
how can I send the person to the login page in case he copy the url in
the browser and never pass for the login page.

Thanks all


Reply via email to