Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Application in JSP Program

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to use Application in the JSP program, the article is very detailed, has a certain reference value, interested friends must read it!

When JSP programs call Javeabean commands, there are Scope settings in UseBean, and generally there are settings such as Application session page. Page is to recreate new javabean objects in usebean per page. Generally, this is used. If data is shared among multiple JSP programs, session can be used.

And Application means that the javabean will always exist, compared with session users, Application is opposite to the application, generally speaking, a user has a session and disappears as the user leaves, while Application always exists, similar to a servlet program, similar to the "global variable" of the whole system, and only one instance.

Control function in MVC

Therefore, the feature of application is very suitable for doing the control function in MVC. Generally, the traditional MVC uses servlet as the control function, V is basically a JSP page, and M is a middleware such as Javabean.

However, with the improvement and promotion of the function of JSP, there is a tendency to replace servlet gradually. We use JSP more in practice, and sometimes we use JSP instead of servlet in order to save trouble. Especially its control function.

In fact, the control function is encapsulated in a Javabean, and the JSP program uses scope=application to call the Javabean, so that the javabean with control function is like servlet resident in memory and interacts with various middleware in the background.

The display of "Home Page"

In practical applications, we often have multiple users to visit a page at the same time, such as the home page, where there are many functions to run, such as catalog classification, the home program needs to read tree data from the database and expand, output to the home page, this function is encapsulated in Javabean.

Then when the home page JSP program calls this Javabean, it uses scope=application, and then through the tree data buffering algorithm, so that when multiple users visit the home page at the same time, the home page JSP program does not need to start Javabean every time and then read the database repeatedly. There is no doubt that the speed is greatly improved.

So if you have a high number of JSP visitors to your home page, you should spend more time optimizing it.

Database connection buffering

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report