Java-Web-程序设计模块3.pptVIP

  • 2
  • 0
  • 约3.84万字
  • 约 82页
  • 2023-02-09 发布于江西
  • 举报
项目8 存储用户会话 8.3扩展——cookie (1)记录用户以往访问当前站点的相关信息 程序3-16:exam8_cookie_login.jspbody标签中代码如下所示: body h6用户登录/h6 % String username=””;//准备用来存储从cookie中读取的用户名的变量 Cookie[] cookies=request.getCookies();//获取客户端与本站点相关的所有cookie if(cookies!=null){ //遍历cookies for(int i=0;icookies.length;i++){ Cookie currentC=cookies[i]; //如果找到名为”username”的cookie,则将其值存入变量username中 if(currentC.getName().equals(“username”)){ username=currentC.getValue(); } } } % form action=”exam8_cookie_login_do.jsp” method=”post” 用户名:input type=”text” name=”username” value=”%=username %”/br/ 密码:input type=”tex

文档评论(0)

1亿VIP精品文档

相关文档