⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0183.htm

📁 JspServlet教程专栏 对javaservlet讲述的非常详细
💻 HTM
字号:
<html>

<head>
<title>新时代软件教程:操作系统 主页制作 服务器 设计软件 网络技术 编程语言 文字编辑</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
<!--
body, table {font-size: 9pt; font-family: 宋体}
a {text-decoration:none}
a:hover {color: red;text-decoration:underline}
.1  {background-color: rgb(245,245,245)}
-->
</style>
</head>
<p align="center"><script src="../../1.js"></script></a>
<p align="center"><big><strong>session写的简单计数器</strong></big></p>
<div align="right">---摘自互联网</div>

<br>&lt;%@&nbsp; page&nbsp; errorPage="errorpage.jsp"&nbsp; %><br>
<br>
&lt;html><br>
&lt;head><br>
&lt;title>UseSession&lt;/title><br>
&lt;/head><br>
&lt;body><br>
&lt;%<br>
//&nbsp; Try&nbsp; and&nbsp; get&nbsp; the&nbsp; current&nbsp; count&nbsp; from&nbsp; the&nbsp; session<br>
Integer&nbsp; count&nbsp; =&nbsp; (Integer)session.getAttribute("COUNT");<br>
<br>
//&nbsp; If&nbsp; COUNT&nbsp; is&nbsp; not&nbsp; found,&nbsp; create&nbsp; it&nbsp; and&nbsp; add&nbsp; it&nbsp; to&nbsp; the&nbsp; session<br>
if&nbsp; (&nbsp; count&nbsp; ==&nbsp; null&nbsp; )&nbsp; {<br>
<br>
count&nbsp; =&nbsp; new&nbsp; Integer(1);<br>
session.setAttribute("COUNT",&nbsp; count);<br>
}<br>
else&nbsp; {<br>
<br>
count&nbsp; =&nbsp; new&nbsp; Integer(count.intValue()&nbsp; +&nbsp; 1);<br>
session.setAttribute("COUNT",&nbsp; count);<br>
}&nbsp; <br>
//&nbsp; Get&nbsp; the&nbsp; User's&nbsp; Name&nbsp; from&nbsp; the&nbsp; request<br>
out.println("&lt;b>Hello&nbsp; you&nbsp; have&nbsp; visited&nbsp; this&nbsp; site:&nbsp; "<br>
+&nbsp; count&nbsp; +&nbsp; "&nbsp; times.&lt;/b>");<br>
%><br>
&lt;/body><br>
&lt;/html>

  </table>
<p align="center"><script src="../../2.js"></script></a>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -