在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=<%=shoes.getShoes_id() %>"><%=shoes

本文介绍了如何在JavaScript中调用Java的方法,通过在HTML中嵌入JavaScript代码,然后通过servlet作为桥梁,最终实现调用Java后台的ShopShoesDao和ShopServlet中的具体方法。
最低0.47元/天 解锁文章
2万+

被折叠的 条评论
为什么被折叠?



