javabean--Save Range

Source: Internet
Author: User

1. Page: Current pages

2. Request: In a single server jump range

3. Session: Once user operation range, reopen browser invalidation

4. Application: The entire server is saved and the server shuts down.

Define a Count.java and put it in web-info\classes.

 Package Cn.mldn.lxh.demo;  Public class count {    privateint count = 0 ;      Public count () {        System.out.println ("=========== a new Count object produces ===========");    }      Public int GetCount () {        returnthis. Count;    }}

Define a page to save the scope of the JSP file:

class= "Cn.mldn.lxh.demo.Count"/><body>

Jump to 02:

class= "Cn.mldn.lxh.demo.Count"/><body>

Server-side display "A new count object generated" number of times: 2

Refresh page display number of visits: 1.

So if you want to be effective when the server jumps, use request:

01:

class= "Cn.mldn.lxh.demo.Count"/><body>

02:

class= "Cn.mldn.lxh.demo.Count"/><body>

Server-side display "A new count object generated" number of times: 1

Number of Visits: 2

Session mode:

class= "Cn.mldn.lxh.demo.Count"/><body>

Server-side display "A new count object generated" Count: 1, not created after refresh

Number of Visits: +1

When opening a new browser:

Server-side display "A new count object generated" number of times: 1

Number of Visits: +1

Application Way:

class= "Cn.mldn.lxh.demo.Count"/><body>

Server-side display "A new count object generated" count: not refreshed

Number of visits: 6,7,8 ...

Summarize:

As in the JSP4 range, the difference: the page range is not PageContext, you can specify directly

javabean--Save Range

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.