📄 viewcategory.jsp
字号:
<%@ page contentType="text/html; charset=gbk" language="java" pageEncoding="GBK"%>
<%@ page import="java.util.Collection"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="com.jspdev.ch12.Category"%>
<jsp:useBean id="viewCategory" class="com.jspdev.ch12.ViewCategory" scope="page"></jsp:useBean>
<html>
<head>
<title>查看所有商品类别</title>
<link rel="stylesheet" type="text/css" href="../css/styles.css">
<script type="text/javascript" src="../js/common.js"></script>
</head>
<body>
<center>
<h1>查看所有的商品</h1>
<form name="form2" method="post" action="">
<table border="1" width="80%">
<tr bgcolor="#009966" bordercolor="#990066">
<td>ID</td><td>类别名</td><td>描述</td></tr>
<%
Collection categorys = viewCategory.getAllCategory();
Iterator it = categorys.iterator();
while(it.hasNext()) {
Category temp = (Category)it.next();
%>
<tr bgcolor="#009966">
<td><a href="searchProductByCategory.jsp?category=<%=temp.getCategoryId() %>"><%=temp.getCategoryId() %></a></td>
<td><%=temp.getName() %></td>
<td><%=temp.getDescription() %></td></tr>
<%
}
%>
<tr><td><input type="button" value="返回首页" onclick="returnindex()"></td></tr>
</table>
<br>
<p>这个例子就不再做增删改的操作了,它和产品是一样的。</p>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -