hello daniel, some additional information: just to avoid misunderstandings - the summary of the suggestion has no reference to the NavigationHandler approach because in that case your init-method would get executed before.
generally spoken: to implement a custom NavigationHandler is just an alternative approach (in your case it doesn't solve your problem). if someone is interested in this approach you will find an example at: http://www.jsftutorials.net/jsfNavigation/jsf-login-navigation-redirect.html (i didn't look at the details of this specific solution - it's just an example... - and they also suggest to use a PhaseListener) regards, gerhard 2007/11/24, Gerhard Petracek <[EMAIL PROTECTED]>: > > hello daniel, > > i would like to suggest other solutions. > > i think you are familiar with the common ways of handling navigation > (summarized - e.g. if you use the "from-outcome" approach an action-method > returns the outcome or you use a static string within your page - with this > approach only these outcomes are used for navigation) > -> if your "init"-method is not an action method (it doesn't sound like > one) - you should consider alternative solutions. > > --- just a general information before we start --- > with this additional information i don't refer to the solution you are > having in mind! > basically you can manually navigate e.g. with: > > FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation( > ... ); > or with: > FacesContext.getCurrentInstance().getExternalContext().redirect( > ... ); > > however, be careful with these mechanisms - they don't work at any point > of your application and you risk to "break" your application if you misuse > these mechanisms. > --- > > if you don't like to use security extensions such as Acegi you have to > implement custom mechanisms to provide login pages and to avoid initial > actions within your bean. in that case i would suggest more generic > solutions - e.g. a custom PhaseListener or a custom NavigationHandler. > > to summarize my suggestion: use/implement a mechanism which takes place > before your init-method gets executed. > > regards, > gerhard > > > > 2007/11/23, daniel ccss <[EMAIL PROTECTED]>: > > > > 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 > > > > > > -- > > http://www.irian.at > > Your JSF powerhouse - > JSF Consulting, Development and > Courses in English and German > > Professional Support for Apache MyFaces -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces

