1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <%@ page import="com.lovecoding.doman.Brand" %>
- <%@ page import="java.util.ArrayList" %>
- <%@ page import="java.util.List" %>
- <%@ page import="java.util.Iterator" %><%--
- Created by IntelliJ IDEA.
- User: 武恒
- Date: 2023/2/6
- Time: 14:42
- To change this template use File | Settings | File Templates.
- --%>
- <%@ page contentType="text/html;charset=UTF-8" language="java" %>
- <html>
- <head>
- <title>Title</title>
- </head>
- <body>
- <%
- // 查询数据库
- List<Brand> brands = new ArrayList<Brand>();
- brands.add(new Brand(1,"三只松鼠","三只松鼠",100,"三只松鼠,好吃不上火",1));
- brands.add(new Brand(2,"优衣库","优衣库",200,"优衣库,服适人生",0));
- brands.add(new Brand(3,"小米","小米科技有限公司",1000,"为发烧而生",1));
- %>
- <h4 style="text-align: center;">商品表格</h4>
- <table border="1" cellspacing="0" width="800" align="center">
- <tr align="center">
- <td><b>序号</b></td>
- <td><b>LOGO</b></td>
- <td><b>商品</b></td>
- <td><b>企业</b></td>
- </tr>
- <%
- Iterator<Brand> iterator = brands.iterator();
- while ( iterator.hasNext() ) {
- Brand next = iterator.next();
- %>
- <tr align="center">
- <td><%=next.getId()%></td>
- <td><img src="https://p0.itc.cn/images01/20210304/095a3fabfc7e48fdbcdb16e5df45d3fe.jpeg" width="30"></td>
- <td><%=next.getBrandName()%></td>
- <td><%=next.getCompanyName()%></td>
- </tr>
- <%
- }
- %>
- </table>
- <%
- /**
- * JSP 四大域 数据的作用域
- * page 只限于 当前页面
- * request 只限于一次请求
- * session 只限于一次会话
- * application 整个应用
- */
- %>
- </body>
- </html>
|