I have a question regarding the redirect functions in the pages.xml. I could not find a solution in the forums; sorry if it is there.
What I'd like to achieve is to redirect everything to my main page; this means that if someone enters the name of an existing view in the address bar (eg: http:localhost:8080/myapp/pages/someotherpage.xhtml) the user is automatically redirected to my standard home.seam.
This should always be the case even if the user is logged in, admin or anything else.
Is this at all possible?
I have tried the below page tage in the pages.xml.
<page view-id="*" login-required="true"> <navigation> <redirect view-id="/pages/home.xhtml" /> </navigation> </page>
This will works the first time(ie when the user is not logged in and enters an illegal page) but returns to the illegally entered page as soon as the user is logged in.
Removing the login-required
true didn't help.
Thanks in advance.
You probably need to do a bit of coding. I would create an action that tests if a view exists or not, not sure what the best way to do this is, one way is to see if FaceletFactory.getInstance().getFacelet(viewId) throws an exception.
Then put in a navigation rule that navigates based on the result of your viewExists function.