-
1. Re: Page redirects from session beans
lich Jun 24, 2008 7:28 AM (in response to greatguns)FacesManager.instance().redirect(...),i am no sure. Usually you should return a String and use page navigation to redirect.
-
2. Re: Page redirects from session beans
mail.micke Jun 24, 2008 9:49 AM (in response to greatguns)You can use something like this
public static void redirectTo(final String aRedirectUrl){ try { FacesContext.getCurrentInstance(). getExternalContext(). getResponse(). sendRedirect( aRedirectUrl); } catch (IOException e) { e.printStackTrace(); } }
-
3. Re: Page redirects from session beans
greatguns Jun 24, 2008 8:12 PM (in response to greatguns)Thank you both for the help.
I will try it out today :).
-
4. Re: Page redirects from session beans
greatguns Jun 25, 2008 5:20 AM (in response to greatguns)That worked Great!!!
Thank you for your help :D
-
5. Re: Page redirects from session beans
graben Jun 26, 2008 8:18 PM (in response to greatguns)Another possible solution is the seam built in redirection component. I think this should work better than the above one since it won't start the redirect immediately but after successfully ending of the methods. It's the seam standard way!
Example:
Redirect redirect = Redirect.getInstance(); redirect.setViewId(/xxx.xhtml) ...
-
6. Re: Page redirects from session beans
dhinojosa Jun 26, 2008 10:04 PM (in response to greatguns)Everyone here is scaring me, and this sounds like a bad idea.
Can't you throw an exception from your code and then have pages.xml do the redirecting for you?
<exception class="com.mycorp.NoEntityInjectedStateException"> <redirect view-id="/login.xhtml"> <message>Please log in first</message> </redirect> </exception>
This would keep your code (excluding annotations) decoupled from the framework and thus make it reusable.