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

📄 mainbody.jsp

📁 一个小型的JSP购物网站
💻 JSP
字号:
<%@ page language="java" pageEncoding="gbk"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
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>
  	<script type="text/javascript" language="javascript">
  		function check()
  		{
  			alert("请登陆后再购买商品!!\n\n如果登陆后还不能购买请刷新页面.");
  			return false;
  		}
  	</script>
    <base href="<%=basePath%>"> 
    <title>My JSP 'MainBody.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" href="mm_health_nutr.css" type="text/css" />
  </head>
  <body bgcolor="#F4FFE4">
  <c:set var="down" value="下架"></c:set>
  <form action="" method="get">
   <table width="444">
  	<tr>
	  	<td colspan="4"><br/></td>
  	</tr>
  	<tr>	
  		<td><img src="mm_spacer.gif" alt="" width="100" height="1" border="0"/></td>
  		<td colspan="2">
			<table width="600">
				<tr align="center" height="38">	
					<td>商品编号</td>
					<td>商品名称</td>
					<td>商品价格</td>
					<td>所属类别</td>
					<td>库存量</td>
					<td>图片</td>
					<c:if test="<%=request.getParameter("manager")!=null %>">
					<td>当前状态</td>
					<c:if test="<%=request.getParameter("manager_up")!=null || request.getParameter("manager_down")!=null %>">
					<td>更改状态</td>
					</c:if>
						<c:if test="<%=request.getParameter("modify")!=null%>">
						<td>操作</td>
						</c:if>
					</c:if>
					<c:if test="<%=request.getParameter("manager")==null %>">
					<td>放入购物车</td>
					</c:if>
				</tr>
				<tr><c:if test="<%=request.getParameter("manager")!=null %>">
				<td colspan="8"><hr size="1px"></td></c:if>
				<c:if test="<%=request.getParameter("manager")==null %>">
				<td colspan="7"><hr size="1px"></td></c:if></tr>
				<c:forEach var="row" items="${requestScope.Products}">
					<tr align="center" valign="top">
							<td><c:out value="${row.pid}"></c:out></td>
							<td><c:out value="${row.pname}"></c:out></td>
							<td><c:out value="${row.pprice}"></c:out></td>
							<c:forEach var="small" items="${requestScope.smallca}">
								<c:if test="${small.scid==row.smallcid}">
									<td><c:out value="${small.sname}"></c:out></td>
								</c:if>
							</c:forEach>
							<td><c:out value="${row.amount}"></c:out></td>
						<td width="60" align="center">
						
						
						<!-- 判断是说明情况下的操作 -->
						<c:if test="<%=request.getParameter("manager_up")!=null %>">
							<a href="servlet/BodyServlet?manager=true&manager_up=true&page=${pro.currentIndex}" target="body"
								onClick="javascript:window.open('../servlet/PictureServlet?pic=${row.pid}','','toolbars=0,scrollbars=0,location=0,statusbars=0,menubars=0,resizable=0,width=300,height=222');">查看</a>
						</c:if>
						
						<c:if test="<%=request.getParameter("manager")==null %>">
							<a href="servlet/BodyServlet?page=${pro.currentIndex}" target="body"
								onClick="javascript:window.open('../servlet/PictureServlet?pic=${row.pid}','','toolbars=0,scrollbars=0,location=0,statusbars=0,menubars=0,resizable=0,width=300,height=222');">查看</a>
						</c:if>
						<c:if test="<%=request.getParameter("manager_down")!=null %>">
							<a href="servlet/BodyServlet?manager=true&manager_down=true&page=${pro.currentIndex}" target="body"
								onClick="javascript:window.open('../servlet/PictureServlet?pic=${row.pid}','','toolbars=0,scrollbars=0,location=0,statusbars=0,menubars=0,resizable=0,width=300,height=222');">查看</a>
						</c:if>
						<c:if test="<%=request.getParameter("modify")!=null %>">
							<a href="servlet/BodyServlet?manager=true&modify=true&page=${pro.currentIndex}" target="body"
								onClick="javascript:window.open('../servlet/PictureServlet?pic=${row.pid}','','toolbars=0,scrollbars=0,location=0,statusbars=0,menubars=0,resizable=0,width=300,height=222');">查看</a>
						</c:if>
						
						</td>
						<c:if test="<%=request.getParameter("manager")!=null %>">
							<td><c:out value="${row.pstatus}"></c:out></td>
						</c:if>
						<c:if test="<%=request.getParameter("manager_up")!=null %>">
							
							<c:if test="${row.pstatus==down}">
							<td><a href="servlet/ManagerOperatorRackServlet?pid=${row.pid}&up=true"><c:out value="上架"></c:out></a></td>
							</c:if>
						</c:if>
						<c:if test="<%=request.getParameter("manager_down")!=null %>">
							<c:if test="${row.pstatus!=down}">
							<td><a href="servlet/ManagerOperatorRackServlet?pid=${row.pid}&down=true"><c:out value="下架"></c:out></a></td>
							</c:if>

						</c:if>
						<c:if test="<%=request.getParameter("modify")!=null %>">
							<td><a href="servlet/ManagerModifyProductsServlet?pid=${row.pid}&modify=true"><c:out value="修改"></c:out></a></td>
						</c:if>
						<c:if test="<%=request.getParameter("manager")==null %>">
						<td width="60" align="center">
							<c:if
								test="${sessionScope.users==null}">
								<a href="servlet/MyShopperCartServlet" onClick="return check()"><img
										src="Images\pic_myshopping.gif" border="0">
								</a>
							</c:if>
							<c:if
								test="${sessionScope.users!=null}">
								<a href="servlet/MyShopperCartServlet?pid=${row.pid}"><img
										src="Images\pic_myshopping.gif" border="0">
								</a>
							</c:if>
						</td>
						</c:if>
					</tr>
					<tr><c:if test="<%=request.getParameter("manager")!=null %>">
					<td colspan="8"><hr size="1px"></td></c:if>
					<c:if test="<%=request.getParameter("manager")==null %>">
					<td colspan="7"><hr size="1px"></td></c:if>
					</tr>
				</c:forEach>
			</table>
  		</td>
  	</tr>
  	<tr align="center">
  		<td></td>
  		<td>	
  		<c:if test="${sessionScope.pro!=null}">
  		<c:if test="<%=request.getParameter("manager")==null %>">
  		<a href="servlet/BodyServlet?page=1" Target="body">首页</a>
  		<a href="servlet/BodyServlet?page=${pro.currentIndex-1}" Target="body">上一页</a>
  		<a href="servlet/BodyServlet?page=${pro.currentIndex+1}" Target="body">下一页</a>
  		<a href="servlet/BodyServlet?page=${pro.maxPage}" Target="body">尾页</a>
  		当前第${pro.currentIndex}页 共有${pro.maxPage}页
  		</c:if>
  		</c:if>
  		<c:if test="<%=request.getParameter("manager_up")!=null %>">
  		<a href="servlet/BodyServlet?page=1&manager=true&manager_up=true" Target="body">首页</a>
  		<a href="servlet/BodyServlet?page=${pro.currentIndex-1}&manager=true&manager_up=true" Target="body">上一页</a>
  		<a href="servlet/BodyServlet?page=${pro.currentIndex+1}&manager=true&manager_up=true" Target="body">下一页</a>
  		<a href="servlet/BodyServlet?page=${pro.maxPage}&manager=true&manager_up=true" Target="body">尾页</a>
  		当前第${pro.currentIndex}页 共有${pro.maxPage}页
  		</c:if>
  		<c:if test="<%=request.getParameter("manager_down")!=null %>">
  		<a href="servlet/BodyServlet?page=1&manager=true&manager_down=true" Target="body">首页</a>
  		<a href="servlet/BodyServlet?page=${pro.currentIndex-1}&manager=true&manager_down=true" Target="body">上一页</a>
  		<a href="servlet/BodyServlet?page=${pro.currentIndex+1}&manager=true&manager_down=true" Target="body">下一页</a>
  		<a href="servlet/BodyServlet?page=${pro.maxPage}&manager=true&manager_down=true" Target="body">尾页</a>
  		当前第${pro.currentIndex}页 共有${pro.maxPage}页
  		</c:if>
  		<c:if test="<%=request.getParameter("modify")!=null %>">
  		<a href="servlet/BodyServlet?page=1&manager=true&modify=true" Target="body">首页</a>
  		<a href="servlet/BodyServlet?page=${pro.currentIndex-1}&manager=true&modify=true" Target="body">上一页</a>
  		<a href="servlet/BodyServlet?page=${pro.currentIndex+1}&manager=true&modify=true" Target="body">下一页</a>
  		<a href="servlet/BodyServlet?page=${pro.maxPage}&manager=true&modify=true" Target="body">尾页</a>
  		当前第${pro.currentIndex}页 共有${pro.maxPage}页
  		</c:if>
  		</td>
  	</tr>
  </table>
  </form>
  </body>
</html>

⌨️ 快捷键说明

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