Announcement Announcement Module
Collapse
No announcement yet.
How to remember last visited page? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to remember last visited page?

    How to after login enter the page which was visited last before logout?

    Here is security config:

    Code:
      <security:http auto-config="true">
            <security:intercept-url pattern="/login.action" filters="none"/>
            <security:intercept-url pattern="/res/**" filters="none"/>
            <security:intercept-url pattern="/admin/**" access="ROLE_ADMIN"/>
            <security:intercept-url pattern="/**" access="ROLE_USER"/>
            <security:access-denied-handler error-page="/denied.action"/>
    
            <security:form-login login-page='/login.action'
                                 authentication-failure-url="/login.action?login_error=1"
                                 default-target-url='/dashboard.action'/>
        </security:http>
    
    
        <security:authentication-manager>
            <security:authentication-provider ref="portalAuthenticationProvider"/>
        </security:authentication-manager>
    
        <bean id="portalAuthenticationProvider" class="com.colvir.portal.security.PortalAuthenticationProvider">
            <property name="userService" ref="userService"/>
        </bean>
    
          <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"
                    p:targetClass="org.springframework.security.core.context.SecurityContextHolder"
                    p:targetMethod="setStrategyName" p:arguments="MODE_INHERITABLETHREADLOCAL"/>
    Now I always hit dashboard.action after login.
    (As you can see always-use-default-target isn't set.)

  • #2
    If you logout and invalidate the session, you will lose all information.

    So you'd need to record the current page information for each user if you want them to be able to return there after a later login.

    Comment


    • #3
      For logout I use link to /j_spring_security_logout.

      So you'd need to record the current page information for each user if you want them to be able to return there after a later login.
      Is there any samples how to do that?

      Comment


      • #4
        Originally posted by kostepanych View Post
        Is there any samples how to do that?
        Not that I know of. You could potentially use a cookie or store the information in a database when the user logs out, retrieving it when they log back in.

        Comment


        • #5
          What method and in which class should I override to direct user into correct page after login?
          Last edited by kostepanych; Feb 24th, 2011, 07:53 AM.

          Comment

          Working...
          X