⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 details.jsp

📁 基于MVC架构实现的购物车功能
💻 JSP
字号:
<%@ page language="java" import="java.util.*,com.lyh.entity.*" pageEncoding="GBK"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <script language="javascript">
	function displayDate()
	{
		var nowDate=new Date();
		document.getElementById("myTime").value=nowDate.getYear()+"年"+(nowDate.getMonth()+1)+"月"+nowDate.getDate()+"日";
	}
	
	</script>
	<link rel="stylesheet" type="text/css" href="../css/styles.css">
  </head>
  
  <body onload="displayDate()">
    <center>
  <div style="width:98%;position:relative;border:1px solid red;">
  	<div style="width:98%;height:150px;border:1px solid green;">
  		<div style="width:35%;float:left;height:100px;border:1px solid green"><img src=""></div>
  		<div style="width:64%;float:left;display:inline; height:100px;text-align:center;border:1px solid green"><br><br><h2>我学我会,网上订餐系统</h2></div>
  		<div style="width:99%;height:50px;border:1px solid green;float:left;text-align:middle;"><br>|网站首页|关于我们|订餐帮助|网上订餐|客服中心|</div>
  	
  	</div>
  	
  	
  	<div style="width:98%;position:relative;height:500px;border:1px solid blue;">
  		<div style="width:35%;float:left;height:400px;border:1px solid blue;">
  			<img src="">
  			<p></p>
  			<hr>
  			<p>
  			<input type="text" id="myTime" size="20px" >
  			</p>
  			<hr>
  			
  		</div>
  		<div style="width:64%;float:left;display:inline;height:500px; border:1px solid blue;";>
  			<div style="width:99%;height:50px;border:1px solid red;"></div>
  			<div style="width:99%;height:50px;border:1px solid red;"></div>
  			<div style="width:99%;height:30px;text-align:center; border:1px solid red;">我学我会网上点餐系统--餐品详细信息</div>
  			<div style="width:99%;height:300px;text-align:left;border:1px solid red;">
  			<%
  				ArrayList<FoodBean> foods=(ArrayList<FoodBean>)session.getAttribute("foods");
  				FoodBean food=null;
  				String foodID=request.getParameter("foodID");
  				for(int i=0;i<foods.size();i++)
  				{
  					food=(FoodBean)foods.get(i);
  					if(foodID.equals(food.getFoodID().toString()))
  					{
  						//保存餐品到session 属性
  						session.setAttribute("foodToAdd",food);
  						break;
  					}
  				}
  				
  				
  				FoodBean currentFood=(FoodBean)session.getAttribute("foodToAdd");
  				
  			
  			
  			%>
  				<table style="border: 1px solid red;" width="99%">
  				<tr><td rowspan="2"><img src='../images/<%=currentFood.getFoodImage()%>' width="60" height="60"></td><td>菜名:<%=currentFood.getFoodName() %></td></tr>
  				<tr><td>价格:<%=currentFood.getFoodPrice()%></td></tr>
  				<tr><td>编号:<%=currentFood.getFoodID() %></td><td></td></tr>
  				<tr><td>
  				<form method="post" action="../AddFoodToCart">
  				<input type="submit" value="放入购物车">
  				</form>
  				</td>
  				<td>
  				<form method="post" action="/shangji5/ch05/shopCart.jsp">
  				<input type="submit" value="查看购物车">
  				</form>
  				</td></tr>
  				</table>
  				
  				<center>
  				<h5>详细资料</h5>
  				<hr>
  				<img src='../images/<%=currentFood.getFoodImage()%>' width="150" height="120" ><br><h8><%=currentFood.getRemark()%></h8>
  				</center>
  				</div>
  			</div>
  		</div>
  	</div>
  	<div style="width:98%;position:relative;height:50px;border:1px solid yellow;">
  	版权
  	</div>
  
  </center>
  </body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -