Jsp page usage

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.