JavaScript调用Java的方法

本文介绍了如何在JavaScript中调用Java的方法,通过在HTML中嵌入JavaScript代码,然后通过servlet作为桥梁,最终实现调用Java后台的ShopShoesDao和ShopServlet中的具体方法。
摘要由CSDN通过智能技术生成

在JavaScript中想要调用Java的方法,通过JavaScript访问servlet,再通过servlet调用Java某个类的方法。

HTML代码

<table id="cartTable">
    <thead>
        <tr>
            <th class="product_remove">
                <label>
                    <input class="check-all check" type="checkbox"/>  全选
                </label>
                <a class="fl delete" id="deleteAll" href="javascript:;"><i class="fa fa-trash-o"></i></a>
            </th>
            <th class="product_thumb">图片</th>
            <th class="product_name">名称</th>
            <th class="product-price">价格</th>
             <th class="product_quantity">款式</th>
       </tr>
    </thead>
    <tbody>
        <tr>
            <td class="product_remove">
                <input class="check-one check" type="checkbox"/>
            </td>
            <td class="product_thumb">
                <a href="ShopShoesDetails.jsp?shoes_id=<%=shoes.getShoes_id() %>">
                    <img src="${pageContext.request.contextPath}/ShopServlet?method=getShopsShoesImage&shoes_id=<%=shoes.getShoes_id() %>" alt="">
               </a>
            </td>
            <td class="product_name">
                <a href="ShopShoesDetails.jsp?shoes_id=<
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值