A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Refactoring for Software Design Smells: Managing Technical Debt
this week in the
OO, Patterns, UML and Refactoring
How to specify an object in application scope
Joined: May 17, 2001
Jun 10, 2004 04:38:00
How can I specify an object in application scope, for example I have specified in
as follows, similarly I have an object I want to specify it in
<jsp:useBean class="mypack.MyClass" id="MyClassObj" scope="application"/>
Thanks in advance.
Joined: Jul 18, 2001
Jun 10, 2004 06:57:00
All that application scope means in a JSP is that the object is going to be set in the ServletContext. Therefore, to do the same thing in a
you would do:
getServletContext().setAttribute("someAttributeName", new Integer(1));
Word of warning, due to the nature of Servlets and Web Applications, the ServletContext is not thread-safe. Be very careful in how you use it.
I agree. Here's the link:
subject: How to specify an object in application scope
jsp:useBean scope question
Question about page scope and implicit object
Is jsp:useBean scope='session' attribute is going to be deprecated?
jsp:useBean type requirements
Storing InputStream object to Application scope in servlet and retrieving
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015