JSF Redirection Problem

i used the following code to redirect but sometime, it did not succeed.

what's wrong the code?

FacesContext context = FacesContext.getCurrentInstance();

HttpServletResponse response = (HttpServletResponse) context

.getExternalContext().getResponse();

response.sendRedirect(url);

is there any other way to do redirection in JSF?

thanks

terence

[398 byte] By [mtzo81a] at [2007-11-27 8:15:11]
# 1
You can use redirect tag in the faces-config.xml<navigation-case><from-outcome>createTopic</from-outcome><to-view-id>/topiccreate.jspx</to-view-id><redirect /></navigation-case>Regars,Mariusz
syllepsaa at 2007-7-12 19:59:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

i think navigation rules are only for buttons.

my problem is when the user hasnt logged in yet, i need to redirect to login page.

so, i check the session id in page code constructor and do redirection.

i think i cant use navagation rule in my case....

is there any other way to solve this problem?

thanks

terence

mtzo81a at 2007-7-12 19:59:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
try this..FacesContext fc = FacesContext.getCurrentInstance();fc.getExternalContext().redirect(url);
mraja at 2007-7-12 19:59:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
i've already tried that but still the same....
mtzo81a at 2007-7-12 19:59:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
You could try putting a hidden button (rendered="false"), and programmatically invoke it to do redirection.
praveenreddyna at 2007-7-12 19:59:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
can u please show me how to do that?thanksterence
mtzo81a at 2007-7-12 19:59:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...