第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

response.addCookie(cookies);

<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
??? pageEncoding="utf-8"%>
<%@ page import="java.util.ArrayList" %>
<%@ 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>產(chǎn)地:<%=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>產(chǎn)地:<%=i.getCity() %>&nbsp;&nbsp;價格:<%=i.getPrice() %></dt>
?? ??? ?</dl>
?? ?</div>
?? ?<%}
?? ??? ?}%>
</td>
</tr>
</table>
</center>


</body>
</html>



正在回答

4 回答

牛逼的回答可以奧


0 回復(fù) 有任何疑惑可以回復(fù)我~

如果是用的eclipse開發(fā)工具,則需要解碼轉(zhuǎn)碼,然后導(dǎo)入java.net.*包就行了

0 回復(fù) 有任何疑惑可以回復(fù)我~

//1.保存list到cookie中時需要轉(zhuǎn)碼

Cookie cookie = new Cookie("ListViewCookie", URLEncoder.encode(list, "UTF-8"));

response.addCookie(cookie);

//2.讀取cookie,遍歷這個Cookies集合的時候需要解碼

if(cookies!=null && cookies.length>0) {

????for(Cookie c : cookies) {

????????if("ListViewCookie".equals(c.getName())) {

????????????//list = c.getValue();

????????????//由于cookie保存list的時候,經(jīng)過轉(zhuǎn)碼,所以提取的時候也要解碼

????????????list = URLDecoder.decode(c.getValue(), "UTF-8");

????????}

????}

}

前面有人已經(jīng)解答了。

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

憂傷的民工

解決了?
2018-05-26 回復(fù) 有任何疑惑可以回復(fù)我~
#2

qq_下頁天空_0

還是不行
2018-05-28 回復(fù) 有任何疑惑可以回復(fù)我~

http://img1.sycdn.imooc.com//5a4ef41d0001f07709020347.jpg


報這個錯?? 啥意思????

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

response.addCookie(cookies);

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號