简单的购物车应用案例 相关代码1
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<title>购物肉类商品页面</title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
if(request.getParameter("c1")!=null)
session.setAttribute("s1", request.getParameter("c1"));
if(request.getParameter("c2")!=null)
session.setAttribute("s2", request.getParameter("c2")) ;
if(request.getParameter("c3")!=null)
session.setAttribute("s3", request.getParameter("c3"));
%>
各类肉大甩卖,一律十块:<br>
<form method="post" action="a.jsp">
<p>
<input type="checkbox" name="c1" value="猪肉">猪肉
<input type="checkbox" name="c2" value="牛肉">牛肉
<input type="checkbox" name="c3" value="羊肉">羊肉
</p>
<p>
<input type="submit" value="提交" name="B1">
<a href="b.jsp">买点别的</a>
<a href="c.jsp">查看购物车</a>
</p>
</form>
</body>
</html>