myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "daniel ccss" <danielcc...@gmail.com>
Subject Simple Question (Action Call from BackingBean init method)
Date Fri, 23 Nov 2007 15:43:05 GMT
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

Mime
View raw message