简单的购物车应用案例 相关代码4
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'd.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<%request.setCharacterEncoding("utf-8"); %>
小伙子你有钱吗?还买东西! <br>
<a href="e.jsp">清空购物车</a>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>显示购物车购物信息</title>
</head>
<body>
已经清空:<br>
<%request.setCharacterEncoding("utf-8");
String str=" ";
if(session.getAttribute("s1")!=null){
session.removeAttribute("s1");
}
if(session.getAttribute("s2")!=null){
session.removeAttribute("s2");
}
if(session.getAttribute("s3")!=null){
session.removeAttribute("s3");
}
if(session.getAttribute("s4")!=null){
session.removeAttribute("s4");
}
if(session.getAttribute("s5")!=null){
session.removeAttribute("s5");
}
if(session.getAttribute("s6")!=null){
session.removeAttribute("s6");
}
%>
<br><br>
<a href="c.jsp">返回购物车</a><br>
</body>
</html>