详情功能

// 实现详情功能
    @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;
    }

猜你喜欢

转载自www.cnblogs.com/qsy0021/p/11751411.html