Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

334
Views
how to prevent user to go back again from success page to payment page after successful payment in spring boot, jsp?

I am trying to prevent user from going back if done any payment. If the payment is successfully done then redirecting to success page and showing some message there. Now, I want if user clicks on back button then, he should not be able to redirect to checkout page, instead of that I want to redirect them to dashboard. Below is my javascript function to check payment status and then if successful, redirect to success page.

function checkStatus(status){
      switch(status){
            case "succeeded":
                showmessage("Payment succeeded!");
                break;
            case "processing":
                showmessage("Your payment is processing.");
            break;
           case "requires_payment_method":
            showmessage("Your payment was not successful, please try again.");
            break;
           default:
            showmessage("Something went wrong.");
                break;
            }
         }
         function showmessage(response){
             if(response == "Payment succeeded!"){
                 window.location.href = 'success';
             }else{
                 window.location.href = 'failed'; 
             }
         }

Below is controller for success function:

@RequestMapping(value= {WebUrl.success},method= {RequestMethod.GET,RequestMethod.POST})
    public @ResponseBody ModelAndView success(HttpServletRequest request, HttpSession session) {
        logger.info("Payment Success Page is called ");
        ModelAndView modelAndView;
        User loginuser = (User)session.getAttribute("user");
        
        if(loginuser == null || !loginuser.getRoles().toString().equalsIgnoreCase("[ROLE_CUSTOMER]")) {
            modelAndView = new ModelAndView("redirect:.."+ WebUrl.login);
        }else {
            modelAndView = new ModelAndView(WebUrl.success);
            modelAndView.addObject("loginuser", loginuser);
        }
        return modelAndView;
    }

How to get this in spring boot?

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!