getcookies.jsp
来自「JSP课件以及一个网上书店系统程序,带数据库」· JSP 代码 · 共 30 行
JSP
30 行
<%@ page contentType="text/html;charset=GB2312" language="java" %>
<html>
<head>
<title>获取Cookie的信息</title>
</head>
<body>
<%
Cookie myCookie=new Cookie("Name","ZHT");//建立cookie实例myCookie
Cookie sellBook_Ord=new Cookie("ID","CNZZ060929110");
response.addCookie(myCookie);//保存到客户端
response.addCookie(sellBook_Ord);
Cookie[] AllCookie=request.getCookies();
%><h3>客户端的Cookie信息有</h3>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="1" ID="Table1">
<tr bgcolor="#E6E6E6">
<th height="23">索 引</th>
<th >内 容</th>
</tr>
<%
for(int i=0;i<AllCookie.length;i++){
String cke_index=AllCookie[i].getName();
String cke_value=AllCookie[i].getValue();
%>
<tr align="center" bgcolor="#B1C3D9">
<td><%=cke_index%></td><td><%=cke_value%></td>
</tr> <%}%>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?