Jsp Refresh problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rsrinivasan
    New Member
    • Mar 2007
    • 221

    Jsp Refresh problem

    Hi all,

    I have problem in my JSP page.

    When i press F5 button, it resubmits the page once again and adds the same record once again. But i do not want this one. If you have any idea on this let me know.

    Thanks,
    Srinivasan R.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by rsrinivasan
    Hi all,

    I have problem in my JSP page.

    When i press F5 button, it resubmits the page once again and adds the same record once again. But i do not want this one. If you have any idea on this let me know.

    Thanks,
    Srinivasan R.
    Give the submit button a name and set a value on it when it's submitted by clicking the button. If the page was submitted by refresh that value won't be set.

    Comment

    • praveen2gupta
      New Member
      • May 2007
      • 200

      #3
      Originally posted by rsrinivasan
      Hi all,

      I have problem in my JSP page.

      When i press F5 button, it resubmits the page once again and adds the same record once again. But i do not want this one. If you have any idea on this let me know.

      Thanks,
      Srinivasan R.
      Hi
      pls show your jsp code and display the recoreds which yoy are getting repeated.

      Comment

      • rsrinivasan
        New Member
        • Mar 2007
        • 221

        #4
        Originally posted by praveen2gupta
        Hi
        pls show your jsp code and display the recoreds which yoy are getting repeated.
        Hi,

        Thanks for your reply. I cant send it all. Because it is large file.
        What i have the problem is,
        1. When i click the add button, it sets "formAction s" as 'add' and submit it to the corresponding action class.
        2. And in the action class, i check the variable formActions is 'add' or anyother.
        3. If "formAction s" is 'add', then it will add some field in a table.
        4. Here everything is good what i expect.

        5. But the problem is, now i press F5 button or right click my mouse and press refresh button, it adds one more time the same record into the table.

        6. Because the "actionForm " value is still have the same value 'add'.
        7. How to resolve the problem.

        Thanks,
        Srinivasan R.

        Comment

        • r035198x
          MVP
          • Sep 2006
          • 13225

          #5
          Originally posted by rsrinivasan
          Hi,

          Thanks for your reply. I cant send it all. Because it is large file.
          What i have the problem is,
          1. When i click the add button, it sets "formAction s" as 'add' and submit it to the corresponding action class.
          2. And in the action class, i check the variable formActions is 'add' or anyother.
          3. If "formAction s" is 'add', then it will add some field in a table.
          4. Here everything is good what i expect.

          5. But the problem is, now i press F5 button or right click my mouse and press refresh button, it adds one more time the same record into the table.

          6. Because the "actionForm " value is still have the same value 'add'.
          7. How to resolve the problem.

          Thanks,
          Srinivasan R.
          Like I said, onClick of the submit button, set a flag on a field that you also submit and check for that flag.

          Comment

          • nasrin
            New Member
            • Aug 2007
            • 1

            #6
            hello dear!
            After I add a record on the jsp page .. if a person happens to refresh the browser a new record is added to database... How do I prevent this?
            I have used javascript ofcourse to disable right click but I cannot disable the refresh button since I am not opening it from a link but its a form submit... Is there any other better solution to this?

            Your input is really appreciated

            Comment

            Working...