JSP_ Attribute Range _application

Source: Internet
Author: User

If you want to set a property that can be seen by all users, you can set the property scope to application so that the property can be saved on the server.

Here is a small example to verify:

(1) application_demo.jsp

1<%@ page contenttype= "text/html; Charset=utf-8 "Language=" Java "Import= "java.util.*" errorpage= ""%>2<!doctype html>345<meta charset= "Utf-8" >6<title>application Attribute Range </title>78 9<body>Ten<% OneApplication.setattribute ("name", "Lisi"); AApplication.setattribute ("Birthday",NewDate ()); -%> -<a href= "application_demo2.jsp" > Get Properties by Hyperlink </a> the</body> -

(2) application_demo2.jsp

1<%@ page contenttype= "text/html; Charset=utf-8 "Language=" Java "Import= "java.util.*" errorpage= ""%>2<!doctype html>345<meta charset= "Utf-8" >6<title>application Attribute Range </title>78 9<body>Ten<% OneString Name= (String) application.getattribute ("name"); ADate birthday= (date) application.getattribute ("Birthday"); -%> - the -</body> -

Browser display: (At this point we open two different browsers)

Note: Too many property settings in the application range can affect server performance.

JSP_ Attribute Range _application

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.