Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

342
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda