jsp的购物车的实现,简单原理,采用简单的分层。
jsp购物车代码
//shopping.html
<html>
<head><title>shoppingstor</title></head>
<body>
<formaction="carts.jsp"target="post">
<br>
pleaseselecttheitemthatyouwanttobuy
<br>
<selectname="item">
<option>book:oldmanandthesea
<option>x-boxgamemachine
<option>mp3player
<option>cce
<option>book:jspprogramming
<option>cd"theendlesslove"
<option>dvd"gonewiththewind"
</select>
<br>
<inputtype="submit"name="submit"value="add">
<inputtype="submit"name="submit"value="remove">
</form>
</body>
</html>
jsp购物车代码有哪些
//carts.jsp
<html>
<jsp:useBeanid="cart"scope="session"class="test.DummyCart"/>
<jsp:setPropertyname="cart"property="*"/>
<%
cart.processRequest();
%>
<br>
<ol>
youhavechosentheseitems:
<%
String[]items=cart.getItems();
for(inti=0;i<items.length;i++)
{
%>
<li><%=items[i]%></li>
<%
}
%>
</ol>
<hr>
</html>
总之,jsp购物车代码给大家简单的介绍了一些,希望大家多看看。