Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

338
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda