Set and obtain the page range attribute: page_scope_01.jsp
The code is as follows: |
Copy code |
<% @ Page language = "java" contentType = "text/html" pageEncoding = "GBK" %> <% @ Page import = "java. util. *" %> <Html> <Head> <Title> Test </titlte> </Head> <Body> <% // Set page attributes PageContext. setAttribute ("name", "James "); PageContext. setAttribute ("birthday", new Date ()); %> <% // Retrieve the attribute from the page attribute range String username = (String) pageContext. getAttribute ("name "); Date userbirthday = (Date) pageContext. getAttribute ("birthday "); %> <H1> <% = username %> <H2> <% = userbirthday % </Body> </Html> |
If you use the jump execution to obtain the property: page_scope_02.jsp
The code is as follows: |
Copy code |
<% @ Page language = "java" contentType = "text/html" pageEncoding = "GBK" %> <% @ Page import = "java. util. *" %> <Html> <Head> <Title> Test </title> </Head> <Body> <% // Set page attributes PageContext. setAttribute ("name", "James "); PageContext. setAttribute ("birthday", new Date ()); %> <Jsp: forward page = "page_scope_03.jsp"/> </Body> </Html> |
Page after jump: page_scope_03.jsp
The code is as follows: |
Copy code |
<% @ Page language = "java" contentType = "text/html" pageEncoding = "GBK" %> <% @ Page import = "java. util. *" %> <Html> <Head> <Title> Test </title> </Head> <Body> <% // Retrieve the attribute from the page attribute range String username = (String) pageContext. getAttribute ("name "); Date userbirthday = (Date) pageContext. getAttribute ("birthday "); %> <H1> Name: <% = username %> <H2> Birthday: <% = userbirthday %> </Body> </Html>
|
The execution result property is null.
Class getClass returns the class of this Object
2 int hashCode () returns the hash code of this Object
3 boolean equals (Object obj) determines whether the Object is equal to the specified Object.
4 void copy (Object obj): copy the Object to the specified Object.
5. clone () this Object.
6 String toString () converts the Object to a String Object.
7 void Y () wake up a waiting thread
8 void yyall () wake up all waiting threads
9 void wait (int timeout) causes a thread to wait until the timeout ends or is awakened
10 void wait () enables a thread to wait until it is awakened
11 void enterMonitor () locks the Object
12 void exitMonitor () locks the Object