Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to prevent session data on page refresh ?

    Hi all,

    I am explaining flow of my application.
    1. User logs in the application.
    2 on successful login there are multiple widgets.
    3. user selects the specifci city from list on one of the widget.
    4. all other widgets refreshes on this function.

    My problem is that when user presses browser Refresh button (or presses F5 key). all the data lost and need to loging again.

    what we are expecting that on browser refresh, all the data must be persist. or user should found the privious data.the session must not be lost .

    can anybody give some clue/reference/ example so that I can solve this.

    I have stuck on this for last three days. and have no clue still how to do this.


    Thanks &Regards,
    Narendra Shekhawat.

    #2
    What kind of authentication do you use?

    Comment


      #3
      Simple authentication

      Thanks for quick reply.

      I have used simple authentication mechanism.Get username/password from user and match these values to the database table values. and thats it.

      do we need to implement some authentication mechanism for this ?

      something like spring security or something else ?

      please give me brief overview As i am new to this GWT and SmartGWT.
      this is my project in these technologies.

      Thanks

      Comment


        #4
        The simplest way to implement what you want is next(if you use servlet container such as Tomcat or Jetty)
        1) Implement Form based authentification(example can be found here http://onjava.com/pub/a/onjava/2002/06/12/form.html)
        2) After successful login use sessionId to store your state on server
        3) On page refresh restore state

        Comment


          #5
          Module unload when clicks on browser refresh button.

          Thanks for giving your valuable time.

          but the problem I have identified is that the module is unloaded when user presses the browser refresh button.so my question is that how can I stop unloading and reloading of module on page refresh. ?

          Please give me suggestion/reference regarding this.

          Thanks &Regards,
          Narendra Shekhawat.

          Comment


            #6
            you could consider the use of cookies to 'store' the sessionID client-side

            maybe this helps: http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ

            Comment


              #7
              got java.lang.UnsatisfiedLinkError

              hi thnx for your reply,

              I am using following code from given link:
              Code:
              sessionID = request.getSession().getId();
              final long DURATION = 1000 * 60 * 60 * 24 * 14; //duration remembering login. 2 weeks in this example. 
              Date expires = new Date(System.currentTimeMillis() + DURATION); 
              	    Cookies.setCookie("sid", sessionID, expires, null, "/", false);
              after using this link I got following error:
              Code:
              java.lang.UnsatisfiedLinkError: com.google.gwt.user.client.Cookies.setCookieImpl(Ljava/lang/String;Ljava/lang/String;DLjava/lang/String;Ljava/lang/String;Z)V
              	at com.google.gwt.user.client.Cookies.setCookieImpl(Native Method)
              	at com.google.gwt.user.client.Cookies.setCookie(Cookies.java:105)
              	at com.csonet.app.smartgwt.server.WidgetSrvc.service(WidgetSrvc.java:133)

              I am googling regarding this.

              have you any clue about this ?

              Thanks &Regards,
              Narendra Shekhawat.

              Comment

              Working...
              X