-
1. Re: [NEWBIE Q] redirecting to a certain page if already logg
pmuir Jan 30, 2008 2:51 PM (in response to reyjexter)You can use a page action for this - check if the user is logged in, if they are, direct them to a different page.
-
2. Re: [NEWBIE Q] redirecting to a certain page if already logg
brachie Jan 30, 2008 3:49 PM (in response to reyjexter)Hi,
here is a wiki-article about the topic:
http://wiki.jboss.org/wiki/Wiki.jsp?page=AutomaticLoginRedirection
It works but I have the problem, that I get an infinite loop when trying to I enter the application directly calling login.seam page. If I do this an enter my login/passwd the NotLoggenInException is thrown in a loop and the browser displays some kind of redirection error.
What I want is the following:
- call my login.seam page, login and be redirected to the page defined in pages.xml
- if I am logged in and call the login.seam page I want to be redirected to the page defined in pages.xml
Has anybody a working example of the pages.xml to do this? It seems to be a bit tricky and not trivial otherwise this kind of dummy-function in the wiki-article wouldn't be needed. But as mentioned even with this I don't get it working for 100%.
Greetings,
Alexander -
3. Re: [NEWBIE Q] redirecting to a certain page if already logg
fernando_jmt Jan 30, 2008 4:56 PM (in response to reyjexter)How your pages.xml login page is configured?
Does it have login-required="false"?
like:<page view-id="/login.xhtml" action="#{identity.login}" login-required="false"> <navigation from-action="#{identity.login}"> <rule if="#{identity.loggedIn}"> <redirect view-id="/home.xhtml"/> </rule> </navigation> </page>
BTW, you can invoke to any action you want when the page is loaded and then use the rules in order to forward to any page you want. -
4. Re: [NEWBIE Q] redirecting to a certain page if already logg
wachtda Jan 31, 2008 5:21 AM (in response to reyjexter)hello together
what is with manualy entered urls?
if the user types in: http://server/application/login.seam
no action is fired and this cause that the doesnt apply!
any suggestions?
daniel -
5. Re: [NEWBIE Q] redirecting to a certain page if already logg
reyjexter Jan 31, 2008 9:11 AM (in response to reyjexter)hey thanks for all the replies.
anyway this is my login.page.xml (just the same as the pages.xml but specifically for login page. i just use this because this is generated by seam-gen):<?xml version="1.0" encoding="UTF-8"?> <page xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd" login-required="false" action="#{userAuthenticator.checkLogin}"> <navigation> <rule if="#{identity.loggedIn}"> <redirect view-id="/dashboard1234.xhtml"/> </rule> </navigation> <navigation from-action="#{identity.logout}"> <redirect view-id="/login.xhtml" /> </navigation> <navigation from-action="#{identity.login}"> <rule if="#{identity.loggedIn}"> <redirect view-id="/dashboard.xhtml"/> </rule> </navigation> </page>
i agree with wachtda that the page action doesnt fire if you try to access the login.seam directly. when i use the base url instead, i am redirected to login.seam and the page action for login page is executed.
rey -
6. Re: [NEWBIE Q] redirecting to a certain page if already logg
fernando_jmt Jan 31, 2008 10:06 AM (in response to reyjexter)Try the following change:
<?xml version="1.0" encoding="UTF-8"?> <page xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd" login-required="false" action="#{userAuthenticator.checkLogin}"> <navigation from-action="#{userAuthenticator.checkLogin}"> <rule if="#{identity.loggedIn}"> <redirect view-id="/dashboard1234.xhtml"/> </rule> </navigation> <navigation from-action="#{identity.logout}"> <redirect view-id="/login.xhtml" /> </navigation> <navigation from-action="#{identity.login}"> <rule if="#{identity.loggedIn}"> <redirect view-id="/dashboard.xhtml"/> </rule> </navigation> </page>