旅游门户网站03

旅游门户网站03

旅游线路的详情展示

在这里插入图片描述

Servlet

public void detail(HttpServletRequest request,HttpServletResponse response) throws IOException {
    String rid_ = request.getParameter("rid");
    Integer rid = Integer.parseInt(rid_);
    Route route = service.findRouteByid(rid);
    writeResponse(route,response);
}

service:

@Override
public Route findRouteByid(Integer rid) {
    Route route =routeDao.findRoutrByid(rid);

    Category category = categoryDao.findCnameByid(route.getCid());
    route.setCategory(category);

    Seller seller = sellerDao.findSellerByid(route.getSid());
    route.setSeller(seller);

    List<RouteImg> imgs = routeImgDao.findImgsByRid(rid);
    route.setImages(imgs);
    return route;
}

Dao

@Override
public Route findRoutrByid(Integer rid) {
    Route route = jdbcTemplate.queryForObject("select * from tab_route where rid = ?", new BeanPropertyRowMapper<Route>(Route.class), rid);


    return route;
}

@Override
    public Category findCnameByid(Integer cid) {
        Category category = jdbcTemplate.queryForObject("select * from tab_category where cid = ?", new BeanPropertyRowMapper<Category>(Category.class), cid);

        return category;
    }

@Override
    public List<RouteImg> findImgsByRid(Integer rid) {
        List<RouteImg> list = jdbcTemplate.query("select * from tab_route_img where rid = ?", new BeanPropertyRowMapper<RouteImg>(RouteImg.class), rid);
        return list;
    }
$(document).ready(function() {

    var rid=getParameter("rid");
    var currentPage =getParameter("currentPage");
    $.get("route/detail",{rid:rid},function (route) {
        $("#rname").html(route.rname);
        $("#id").html(route.category.cname);
        $("#name").html(route.rname);
        $("#sy").prop("href","http://localhost:80/sumang/index.html");
        $("#name").prop("href","http://localhost:80/sumang/route_detail.html?rid="+rid);

        $("#id").prop("href","http://localhost:80/sumang/route_list.html?cid="+route.category.cid+'&currentPage='+currentPage);

        $("#rIntro").html(route.routeIntroduce);
        $("#sname").html("经营商家  :"+route.seller.sname);
        $("#sphone").html("咨询电话 : "+route.seller.consphone);
        $("#saddress").html("地址 : "+route.seller.address);
        $("#rprice").html(route.price);
        $("#rcount").html("已收藏"+route.count+"次");
        var images=route.images;
        $("#bigImg").attr("src",images[0].bigPic)
        var lis=' <a class="up_img up_img_disable"></a>';

        for (var i=0;i<images.length;i++){
            if (i>=4){
                lis+=' <a title="" class="little_img"  data-bigpic='+images[i].bigPic+' style="display:none">\n' +
                    '                        <img src='+images[i].smallPic+'>\n' +
                    '                    </a>';
            }
            else {
                lis+=' <a title="" class="little_img" data-bigpic='+images[i].bigPic+' style="">\n' +
                    '                        <img src='+images[i].smallPic+'>\n' +
                    '                    </a>';
            }



        }
        lis+='<a class="down_img down_img_disable" style="margin-bottom: 0;"></a>';

        $("#small").html(lis);
        goImg();
    },"json");
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值