Experience points: Statements in JSP.

Source: Internet
Author: User

Statement in jsp (preferred for SUN Enterprise Applications:
There are two methods to declare in jsp (the preferred choice for SUN Enterprise Applications): <% intCount = 0%> and <%! IntCount = 0%>. Now let's talk about the second one.
1. Test conditions:
Suppose there are two pages: test1.jsp (preferred for SUN Enterprise applications) and test2.jsp (preferred for SUN Enterprise Applications). The following code is available:
<%! IntCount = 0%>
<% IntCount + = 1;
Out. print ("th" + intCount + "times to enter this page! ");
%>
2. test environment: Jrun3 + jdk1.2
3. Test results:
· As long as the intCount is on the same page, it is equivalent to an APPLICATION in ASP. Each user shares this variable, and the initialization intCount = 0 is only executed when the first user logs in.
· Different pages do not affect each other.

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.