1 2 Previous Next 19 Replies Latest reply on Feb 9, 2007 1:13 AM by Shane Bryzak

    Success after logging in... which page???

    Tony Herstell Master

      After logging in I get my success page displayed for some reason.

      The only way to get to success is to use
      <navigation-case>
      <from-outcome>success</from-outcome>
      <to-view-id>/success.xhtml</to-view-id>

      </navigation-case>
      and I am not setting any result that I know of to success...

      How do actually say which page to go to after successful login? (as in my case I want to stay on the same page)?


      in your semspace example you have
      <h:commandButton value="LOGIN" action="#{identity.login}" styleClass="loginButton"/>
      and it appears that you go to welcome.xhtml.
      Just can't find how!

        • 1. Re: Success after logging in... which page???
          Tony Herstell Master

          Ditto for logout.
          I want to go to mainpage.xhtml

          • 3. Re: Success after logging in... which page???
            Shane Bryzak Master

            Here's a couple of pages.xml examples for logging in/out:

             <page view-id="/login.xhtml">
             <navigation from-action="#{identity.login}">
             <rule if-outcome="success">
             <redirect view-id="/mainpage.xhtml"/>
             </rule>
             </navigation>
             </page>
            
             <page view-id="*">
             <navigation from-action="#{identity.logout}">
             <redirect view-id="/mainpage.xhtml"/>
             </navigation>
             </page>
            




            • 4. Re: Success after logging in... which page???
              Tony Herstell Master

              Humm... I don't have a page for logging in. My Login component is part of my template.

              I will try
              <page view-id="*">
              <navigation from-action="#{identity.login}">
              <rule if-outcome="success">
              <redirect view-id="/mainpage.xhtml"/>




              <page view-id="*">
              <navigation from-action="#{identity.logout}">
              <redirect view-id="/mainpage.xhtml"/>



              And assume that "success" is the outcome you always return for login.
              I will move my "success" outcome from my rules to "actionSuccess"

              That should do it...

              • 5. Re: Success after logging in... which page???
                Tony Herstell Master

                My rules were in faces-config
                has something changed (still seems to work).

                • 6. Re: Success after logging in... which page???
                  Tony Herstell Master

                   

                   <navigation-case>
                   <from-outcome>success</from-outcome>
                   <to-view-id>/success.xhtml</to-view-id>
                   <redirect />
                   </navigation-case>
                  


                  • 7. Re: Success after logging in... which page???
                    Tony Herstell Master

                    I want to just return to the same page when I get a success from login (this was easy to as I just returned "null" from my login SessionController.login action

                    I want to go /mainmenu.xhtml from logout.
                    this was easy to as I just returned "mainMenu" from my login SessionController.logout action (after invalidating the session).



                    What do you suggest given:

                    <?xml version="1.0" encoding="UTF-8"?>
                    <!DOCTYPE faces-config
                     PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
                     "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
                    
                    <faces-config>
                    
                     <!-- Navigation rules for the risingstars App -->
                    
                     <navigation-rule>
                    
                     <navigation-case>
                     <from-outcome>mainMenu</from-outcome>
                     <to-view-id>/mainmenu.xhtml</to-view-id>
                     <redirect />
                     </navigation-case>
                    
                     <navigation-case>
                     <from-outcome>success</from-outcome>
                     <to-view-id>/success.xhtml</to-view-id>
                     <redirect />
                     </navigation-case>
                    
                     <!-- Registration -->
                     <navigation-case>
                     <from-outcome>userRegisterDetails</from-outcome>
                     <to-view-id>/userRegistration.xhtml</to-view-id>
                     <redirect />
                     </navigation-case>
                    
                     <navigation-case>
                     <from-outcome>userCRUD</from-outcome>
                     <to-view-id>/userCRUD.xhtml</to-view-id>
                     <redirect />
                     </navigation-case>
                    
                     <navigation-case>
                     <from-outcome>organisationCRUD</from-outcome>
                     <to-view-id>/organisationCRUD.xhtml</to-view-id>
                     <redirect />
                     </navigation-case>
                    
                     <navigation-case>
                     <from-outcome>upload</from-outcome>
                     <to-view-id>/upload.xhtml</to-view-id>
                     <redirect />
                     </navigation-case>
                    
                     <!-- Find Users (for RUD) -->
                     <navigation-case>
                     <from-outcome>findUser</from-outcome>
                     <to-view-id>/userFind.xhtml</to-view-id>
                     <redirect />
                     </navigation-case>
                    
                     <!-- Find Organisation (for RUD) -->
                     <navigation-case>
                     <from-outcome>findOrganisation</from-outcome>
                     <to-view-id>/organisationFind.xhtml</to-view-id>
                     <redirect />
                     </navigation-case>
                    
                     </navigation-rule>
                    
                    
                    
                     <navigation-rule>
                    
                     <from-view-id>/userCRUD.xhtml</from-view-id>
                    
                     <navigation-case>
                     <from-outcome>userCRUDActionConfirm</from-outcome>
                     <to-view-id>/userConfirm.xhtml</to-view-id>
                     <redirect />
                     </navigation-case>
                    
                     </navigation-rule>
                    
                    
                    
                     <navigation-rule>
                    
                     <from-view-id>/userFind.xhtml</from-view-id>
                    
                     <navigation-case>
                     <from-outcome>userCRUD</from-outcome>
                     <to-view-id>/userCRUD.xhtml</to-view-id>
                     <redirect />
                     </navigation-case>
                    
                     </navigation-rule>
                    
                    
                    
                     <navigation-rule>
                    
                     <from-view-id>/userConfirm.xhtml</from-view-id>
                    
                     <navigation-case>
                     <from-outcome>userCRUD</from-outcome>
                     <to-view-id>/userCRUD.xhtml</to-view-id>
                     <redirect />
                     </navigation-case>
                    
                     </navigation-rule>
                    
                    
                     <navigation-rule>
                    
                     <from-view-id>/organisationCRUD.xhtml</from-view-id>
                    
                     <navigation-case>
                     <from-outcome>organisationCRUDActionConfirm</from-outcome>
                     <to-view-id>/organisationConfirm.xhtml</to-view-id>
                     <redirect />
                     </navigation-case>
                    
                     </navigation-rule>
                    
                    
                    
                     <navigation-rule>
                    
                     <from-view-id>/organisationFind.xhtml</from-view-id>
                    
                     <navigation-case>
                     <from-outcome>organisationCRUD</from-outcome>
                     <to-view-id>/organisationCRUD.xhtml</to-view-id>
                     <redirect />
                     </navigation-case>
                    
                     </navigation-rule>
                    
                    
                    
                     <navigation-rule>
                    
                     <from-view-id>/organisationConfirm.xhtml</from-view-id>
                    
                     <navigation-case>
                     <from-outcome>organisationCRUD</from-outcome>
                     <to-view-id>/organisationCRUD.xhtml</to-view-id>
                     <redirect />
                     </navigation-case>
                    
                     </navigation-rule>
                    
                    
                     <managed-bean>
                     <managed-bean-name>highlight</managed-bean-name>
                     <managed-bean-class>com.icesoft.faces.context.effects.Highlight</managed-bean-class>
                     <managed-bean-scope>application</managed-bean-scope>
                     </managed-bean>
                    
                     <application>
                     <view-handler>com.icesoft.faces.facelets.D2DSeamFaceletViewHandler</view-handler>
                     </application>
                    
                     <!-- Select one of the standard transaction models for the Seam application -->
                    
                     <lifecycle>
                     <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
                     </lifecycle>
                    
                     <!-- My Messages Please -->
                     <application>
                     <message-bundle>nz.co.risingstars.i18n.jsfstandarderrors</message-bundle>
                     </application>
                    
                    </faces-config>
                    


                    and

                    <!DOCTYPE pages PUBLIC
                     "-//JBoss/Seam Pages Configuration DTD 1.1//EN"
                     "http://jboss.com/products/seam/pages-1.1.dtd">
                    
                    <pages no-conversation-view-id="/mainmenu.xhtml">
                    
                     <page view-id="/userCRUD.xhtml" timeout="300000">
                     Reason: #{cRUDUserController.mode} User ( #{user.username} )
                     </page>
                     <page view-id="/userConfirm.xhtml" timeout="300000">
                     Reason: Confirm #{cRUDUserController.mode} User (
                     #{user.username} )
                     </page>
                     <page view-id="/userRegistration.xhtml" timeout="300000">
                     Reason: Registration of new User
                     </page>
                    
                     <page view-id="*">
                     <navigation from-action="#{identity.logout}">
                     <redirect view-id="/mainpage.xhtml" />
                     </navigation>
                     </page>
                    
                    </pages>
                    


                    • 8. Re: Success after logging in... which page???
                      Tony Herstell Master

                       

                      <page view-id="*">
                      <navigation from-action="#{identity.logout}">
                      <redirect view-id="/mainpage.xhtml" />
                      </navigation>
                      </page>
                      


                      Doesn't work by the way... either nothing happens or IceFaces barfs with a blocking servlet error

                      • 9. Re: Success after logging in... which page???
                        Gavin King Master

                        If there is no navigation rule defined for the "success" outcome, then the same page will be redisplayed. You're making it more complicated than it needs to be. You don't need any navigation rule at all.

                        • 10. Re: Success after logging in... which page???
                          Gavin King Master

                          OIC, the problem is that you've created a global "success" rule. You should probably change that.

                          I guess I should have used "loggedIn" as the outcome, instead of "success", since "success" is commonly used by other actions. hmmmm.

                          • 11. Re: Success after logging in... which page???
                            Tony Herstell Master

                            Thanks Gavin,

                            I already had a rule set up cus I was using "success" myself...

                            Still trying to get Logout to go Anywhere at the moment!

                            • 12. Re: Success after logging in... which page???
                              Gavin King Master

                              There is a problem with icefaces and logout at this time.

                              • 13. Re: Success after logging in... which page???
                                Tony Herstell Master

                                [Logout] button

                                
                                <ice:panelGrid columns="2" rendered="#{loggedInUser.loggedIn}">
                                 <ice:outputText value="#{loggedInUser.user.username}" />
                                 <ice:commandButton type="submit" value="#{messages.button_logout}" action="#{identity.logout}" styleClass="button"/>
                                 </ice:panelGrid>
                                
                                




                                Gives

                                --->

                                14:43:27,522 ERROR [[Blocking Servlet]] Servlet.service() for servlet Blocking Servlet threw exception
                                java.lang.IllegalStateException: getAttribute: Session already invalidated
                                 at org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1011)
                                 at org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:109)
                                 at com.icesoft.faces.webapp.xmlhttp.ResponseStateManager.getState(ResponseStateManager.java:149)
                                 at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.sendAllUpdates(BlockingServlet.java:375)
                                 at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.executeRequest(BlockingServlet.java:329)
                                 at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:186)
                                 at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                 at java.lang.Thread.run(Thread.java:619)
                                


                                • 14. Re: Success after logging in... which page???
                                  Tony Herstell Master

                                  Ahhh. yes I was writing my post when you posted.
                                  Thanks.

                                  1 2 Previous Next