Using application to realize the function of Sharing message board in JSP

Source: Internet
Author: User

A summary of the knowledge points of application in JSP:

1. Once a Web application is started, a Application object is automatically created, and only one application object is shared throughout the application, that is, all customers accessing the site share a Application object.

2. Function: To save shared data during the whole application operation, to realize the sharing of data between users.

3.application Object life cycle: Starts from the Web server until the Web server shuts down.

The Application object is application-level, and if string name does not exist in application, the object obtained by method object GetAttribute (string name) is null.

The Application object can be manipulated anywhere under the same site, with two main operations, the following two methods:
Object GetAttribute (String name) extracts the specified object from the Application object.
void SetAttribute (String name,object value) adds an object to the Application object.

The basic introduction of this application:

through the application, to realize the shared message board function, as follows:

INPUTMESSAGE.JSP:

<%@ page language= "java" import= "java.text.*,java.util.*" contenttype= "text/html"; Charset=utf-8 "pageencoding=" UTF-8 "%><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >

  

checkmessage.jsp:

<%@ page language= "java" import= "java.text.*,java.util.*" contenttype= "text/html"; Charset=utf-8 "pageencoding=" UTF-8 "%><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >

showmessage.jsp:

<% @pageimport = "com.sun.org.apache.xml.internal.serializer.utils.StringToIntTable"%><%@ page language= " Java "import=" java.util.* "contenttype=" text/html; Charset=utf-8 "pageencoding=" UTF-8 "%><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >

  

Using application to realize the function of Sharing message board in JSP

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.