when do use application scope



Application Scope

If a single Java Bean Object that holds nothing specific to the client has to be used while processing multiple requests then we must use scope=”application”

For every application there will be several application preferences/setting we can store the application preferences as part of a table in DataBase as part of an XML file/as part of a flat file.

We can use an xml as shown below to hold the information about the application preference

Note: Storing the object inside the servletcontext is an application scope

Syntax:

<host-app>

<pref-name>hname</pref-name>

<pref-value>Hospitalone</pref-value>

<pref-name>address</pref-name>

<pref-value>Srnagar</pref-value>

<pref-name>bgcolor</pref-name>

<pref-value>blue</pref-value>

<pref-name>logo</pref-name>

<pref-value>hlogo.jsp</pref-value>

</hosp-app>

save the above code with the extension app-conf.xml

The above data is not specific to the client and is required while processing multiple request.

Random Posts

  • JAVA UTIL PACKAGE
  • Define Stateless Session
  • Life Cycle of stateless session bean
  • Define Session Migration
  • JSF Important Questions

Post a Comment