慕数据7462576
2018-01-05 11:54
报错啦 报错啦
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.util.*" %>
<%@ page import="dao.ItemsDao" %>
<%@ page import="entity.Items" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>详情信息</title>
</head>
<body>
<h1>商品详情</h1>
<hr>
<center>
<table width="750" height="60" cellpadding="0" cellspacing="0" border="0">
<tr>
<%
ItemsDao itemsdao = new ItemsDao();
Items items = itemsdao.getItemsById(Integer.parseInt(request.getParameter("id")));
if(items!= null)
{
%>
<td width="70%" valign="top">
<table>
<tr>
<td rowspan="4"><img src="image/<%=items.getPicture() %>" width="200" height="160"></td>
</tr>
<tr>
<td><%=items.getName() %></td>
</tr>
<tr>
<td>产地:<%=items.getCity() %></td>
</tr>
<tr>
<td>价格:¥<%=items.getPrice() %></td>
</tr>
</table>
</td>
<%
}
%>
<%
String list = "";
Cookie[] cookie = request.getCookies();
if(cookie != null && cookie.length>0){
for(Cookie c:cookie){
if(c.getName().equals("ListCookie")){
list = c.getValue();
}
}
}
list += request.getParameter("id")+",";
String[] str = list.split(",");
if(str != null && str.length > 0){
if(str.length >= 1000){
list = "";
}
}
Cookie cookies = new Cookie("ListCookie",list);
response.addCookie(cookies);
%>
<td width="30%" char="#EEE" align="center">
<p>您浏览过的商品:</p>
<div>
<%
ArrayList<Items> itemslist = itemsdao.getCookieList(list);
if(itemslist != null && itemslist.size()>0){
for(Items i:itemslist){
%>
<dl>
<dt>
<a href="detail.jsp?id=<%=i.getId() %>"><img width="230" height="200" border="" src="image/<%=i.getPicture()%>"></a>
</dt>
<dd><%=i.getName() %></dd>
<dt>产地:<%=i.getCity() %> 价格:<%=i.getPrice() %></dt>
</dl>
</div>
<%}
}%>
</td>
</tr>
</table>
</center>
</body>
</html>
注意标点符号,代码中出现的标点都只能是英文字符
JAVA遇见HTML——JSP篇
248278 学习 · 3071 问题
相似问题