详情功能

// 实现详情功能
    @RequestMapping("/detail")
    public String detail(HttpServletRequest request) {
        // 既然我们想要显示某个花的详情,所以我们需要获取到当前的花是哪一朵
        String fid = request.getParameter("flowerid");
        int id = 0;
        String result = "";
        if (fid != null && !fid.equals("")) {
            id = Integer.parseInt(fid);
        }

        try {
            Flower f = flowerService.getFlower(id);
            request.setAttribute("flower", f);
            // request.getRequestDispatcher("productdetail.jsp").forward(request, response);
            result = "productdetail.jsp";
        } catch (SQLException e) {
            //Log.logger.debug(e.getMessage());
            e.printStackTrace();
        }
        return result;
    }

 

posted on 2019-10-28 11:56  年夜饭  阅读(133)  评论(0编辑  收藏  举报

导航