?? 0181.htm
字號:
<html>
<head>
<title>新時代軟件教程:操作系統(tǒng) 主頁制作 服務器 設計軟件 網(wǎng)絡技術(shù) 編程語言 文字編輯</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>jsp中session的又一個例子</strong></big></p>
<div align="right">---摘自互聯(lián)網(wǎng)</div>
<br>StartPage.jsp<br>
<br>
<br>
<%@ page session="true" %><br>
<%<br>
// first we will put some test data into the bean to show<br>
// we can get it back out again in another page!<br>
String ls_validate = "This is our original session";<br>
session.setAttribute("Validate", ls_validate);<br>
<br>
// Now we will build a string containing the URL for the next page.<br>
// We are encoding session information into the URL string, so as you<br>
// move from page to page, your the Container will know what session<br>
// has been used. Without this information, the container will<br>
// start a new session for each page request.<br>
String ls_session_id = session.getId();<br>
String ls_encode_url = response.encodeURL("NewPage.jsp");<br>
String ls_normal_url = "NewPage.jsp";<br>
%> <br>
<br>
<Html><Head></Head><Body><br>
Sample URL with encoded information: <%= ls_encode_url %> <BR><br>
Our Session id is : <%= ls_session_id %><BR><BR><br>
<br>
<ahref='<%= ls_encode_url %>'> Move to new page and keep session alive</a><BR><BR><br>
<ahref= '<%= ls_normal_url %>'> Move to new page without encoding the URL</a><br>
</Body></Html><br>
<br>
<br>
NewPage.jsp<br>
<Html><Head></Head><Body><br>
<%@ page session="true" %><br>
The Current Session id is: <%= session.getId() %> <br>
<br>
<br>
Checking the value stored in our validate attribute:<br>
<%=session.getAttribute("Validate")%><br>
</Body></Html>
</table>
<p align="center"><script src="../../2.js"></script></a>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -