我的jsp页面上的按钮没有链接到控制器

时间:2017-04-03 20:14:57

标签: java spring spring-mvc spring-boot

您一直试图让我的“开始拍卖”按钮链接到控制器类而没有运气。

这是jsp页面中的按钮 -

<button type="button" class="btn btn-success btn-lg"><a href="../aucConfirm/${newAuction.idauction}/start" >Start Auction</a></button>

这两个控制器方法,confirmAuction有一个model.AddAttribute行 -

@RequestMapping(value = "/aucConfirm/{idauction}", method = RequestMethod.GET)
    public String confirmAuction(@PathVariable(value = "idauction") int idauction, Model model, HttpServletRequest request) {
        AuctionItem addAuction = (AuctionItem) aucRepository.findOne(idauction);
        model.addAttribute("newAuction", addAuction);
        model.addAttribute("startAction", addAuction.getIdauction() + "/start");
        return "aucConfirm";
    }

    @RequestMapping(value = "/aucConfirm/{idauction}/start", method = RequestMethod.GET)
    public String startAuction(@PathVariable(value = "idauction") int idauction, RedirectAttributes redirect) {
        AuctionItem addAuction = (AuctionItem) aucRepository.findOne(idauction);

        List<Image> imageList = (List<Image>) imageRepository.findByidauction(idauction);
        addAuction.setMainImage(imageList.get(0).getImagepath());
        addAuction.setActive(true);
        aucRepository.save(addAuction);
        return "redirect:/listing/" + idauction;

    }

任何人都知道为什么这个按钮不起作用?它什么都不做,甚至没有错误信息。

0 个答案:

没有答案