tomcat :: Listener for my own class (global access to class)

  • Permalink
  • submit to reddit
  • Email
  • Follow


hiI have one servlet with init() method which initialize object of myown class.that's ok if I use this object from only one servlet.but how change it - add Listener and have access to object from allservlets.moreover do not edit any of tomcat files, only project files.thanks
0
Reply devphyl (26) 9/26/2007 8:28:19 PM

See related articles to this posting


devphylosoff <devphyl@gmail.com> said:>I have one servlet with init() method which initialize object of my>own class.>>that's ok if I use this object from only one servlet.>but how change it - add Listener and have access to object from all>servlets.Your init() places the object to application context, so it will beavailable through application context to all other servlets needing it;just take care that the servlet initializing this class is somethingthat it loaded on webapp startup (web.xml init-on-startup, if I recallcorrectly).-- Wolf  a.k.a.  Juha Laiho     Espoo, Finland(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++"...cancel my subscription to the resurrection!" (Jim Morrison)
0
Reply Juha 9/29/2007 8:37:03 PM
comp.lang.java.programmer 51970 articles. 38 followers. Post

1 Replies
319 Views

Similar Articles

[PageSpeed] 24


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

class.class = class
I understand that when you define a new class it´s an instance of Class... class Test end So you can treat "Test" as an object and asks its class : Test.class Class Is this Class itself an object ? Because when i do Class.class, ruby gives me 'Class' So is Class an instance of itself? I don´t understand the logic behind this :( Thanks -- Posted via http://www.ruby-forum.com/. Hi, Am Freitag, 17. Jul 2009, 20:54:26 +0900 schrieb Rubynewbie Rubynewbie: > I understand that when you define a new class it=C2=B4s an instance of > Class... >=20 > c...

Class, Class, where is the Class
Is there a reference somewhere which lists which classes are in which ..jar files? For instance, if I want to use HTTPServlet, which jar file is it in (I know where it is, just an example...)? All the API docs give the package name, but where is the package? TKS!! Wojtek Bok wrote: > All the API docs give the package name, but where is the package? Maybe this is what you search: JWhich http://www.javaworld.com/javaworld/javatips/jw-javatip105.html --- Mario ...

class in class
class A { public: void myfunc1(){return;}; int a12; char p[128]; class C { public: int i123; float f123; }; }; int _tmain(int argc, _TCHAR* argv[]) { A a; A::C t; //how can i access A using t here return 0; } now how can i access the class A from the class C object? -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] Note up front: the term for a class declared inside another class is 'nested class'. subkriskat wrote: > class A > { > class C > { [...] ...

Class class
Hi, Could I construct an object using class class? For example, I want to construct Integer("8") using class Class class=Integer.class; How to use class to obtain an Integer I which is equal to new Integer("8")? Thanks! On 29-5-2005 7:33, eeh wrote: > Hi, > > Could I construct an object using class class? > > For example, I want to construct Integer("8") using class > > Class class=Integer.class; > > How to use class to obtain an Integer I which is equal to new > Integer("8")? > > Thanks! > <http:/...

Class in class?
Hello In Pascal, I use constructions like that var SomeVar =3D object SomeVar2 =3D object end; end; etc., so I could put my object into another object. Is this possible in PHP? Some like: class NameOfClass { class AnotherClass { } } ? The construction above is invalid, I tried. But maybe I can do that another way? TIA. PS: sorry for my english. --=20 greets Tadeusz Nie mozesz czegos takiego zrobic. Tylko... zamiast pytac pr=F3buj! :) You can't do that ;) > Tylko... zamiast pytac pr=F3buj! sorry, nie doczyt...

classes in a class
I have a class that performs transformations on data streams. As written, the class constructor takes several parameters and a data-source to produce it's stream. I have the need to combine the output of two instances of this class to generate a third data stream. (think eg of applying a filters to audio) When I do this, the parameters that I supply the second class are dependent upon the state of the system after the first transform has occured. I have been accomplishing this by using a function outside the class that instantiates the two classes as the information needed to insta...

Nested Class, Member Class, Inner Class, Local Class, Anonymous Class
Hi, What is actually the difference between a Nested Class, a Member Class, an Inner Class, a Local Class, and an Anonymous Class? This is what i know so far: A nested class is probably a generic term for all Class declaration that are not top-level declarations. i.e. so member classes, inner classes, local classes and anonymous classes are all nested classes. Is that correct? An anonymous class doesn't have a formal class name. e.g. we declare an anonymous class that implements an ActionListener as follows: ActionListener al = new ActionListener() { public void actionPerformed(Actio...

How to I access a logging class from any other class.
I want to be able to write log data. How can I access my logging class from any class in the app, without passing a reference to it? SH Responding to Ssg31415926... > I want to be able to write log data. How can I access my logging class > from any class in the app, without passing a reference to it? I'll assume you only have one instance of the logging class. First let me point out that implementing relationships by passing objects is usually not a good idea. The problem is that conceptually one has: R1 R2 [Client] --------- [Service1] ----...

accessing Class from class symbol
Hi, I'm trying to work out how to access Class methods when I only have the class symbol class Foo def Foo.hello puts "Hello Foo" end end class Bar def Bar.hello puts "Hello Bar" end end str="Foo" # I could do this, but there must be a better way. eval "#{str}.hello" Kernel doesn't have send, so I can't pass the class as a symbol to Kernel, and then send the method. Any ideas? Cheers Steve "treefrog" <stephen.hill@motorola.com> writes: > Hi, > I'm trying to work out how to access Cl...

Where to save classes? How to access classes?
Hi, I'm trying to get into the object oriented aspect of Python. If I create a custom class (in it's own file), how do I access that class in a function in a different file? In Java there's the notion of a CLASSPATH, where you can tell the compiler to look for classes. Is there something similar to this in Python? Thanks, Dave David Mitchell wrote: > Hi, > > I'm trying to get into the object oriented aspect of Python. If I create > a custom class (in it's own file), how do I access that class in a > function in a different file? In Java there's t...

Class A contains class B, class B points to class A
Okay. So I have a class A, which contains a vector of B. Any B item is owned by a single, unique A. Indeed, when we create A, A creates its B items. B would like to know which A it is contained in, without having to be perpetually told it by being passed A when B methods are called. How can B store its A (or some handle to A) if A stores B? Say that B has a pointer to its A. However, if I create a copy of an A object and delete the original, all the B->A pointers are invalidated. Doh! Another solution would be to have a boost::shared_ptr to A in each B. But that doesn't work, becau...

A parameterized class (i.e. template class / class template) is not a class?
It appears that the following is not considered a class: template<typename T> class C { }; ? So officially is this considered: a class, a template, a class template, or a template class? I always thought of it as a parameterized class. What would the rationale be for not considering it as just a 'class'? -- Christopher Diggins Object Oriented Template Library (OOTL) http://www.ootl.org christopher diggins wrote: > It appears that the following is not considered a class: > > template<typename T> > class C { }; > > ? > > So officially is ...

Base Class Accessible Accessible As Type Via Derived Class
Hi All, I am trying to locate the specific documentation in TCPPPL 3rd Ed. that says that a class is a scope, and applying the scope resolution operator allows access to types from that scope. Consider: template <class Element> struct Base { Element element; } ; struct Derived : public Base<int> { Base b1; // <int> unnecessary Base b2; // <int> unnecessary } ; First, I can no longer find the page that says that specification of <int> is unnecessary, as there is no ambiguity in type of Base. Furthermore: struct Big { ...

accessing one class from another class
Hello, All. I'm trying to consuming an xml file and map it to a Ruby object that would describe that xml file. What would be the best way to implement the following scenario. Let's say I have several classes: Student, Course, Person, Tuition Xml for this would look like this: <Record> <Student status="good"> <Person> <Name>Alice</Name> <BirthPlace>WonderLand</BirthPlace> </Person> <Course difficulty="> <CourseName>Math III</CourseName> <Grade>B+</Grade> </Course>...

accessing class variables of private classes
Hi, I need to access class variables of a class I'd like to make private: i.e. class __Bar(object): pass class __Foo(__Bar): def __init__(self): super(__Foo, self).__init__() >>> __Foo() Name Error: global name '_Foo__Foo' is not defined Here I want to prevent the user of instanciating __Foo from outside of the module. i.e. class __A: a_list = [] def __init__(self): __A.a_list.append(self) >>> __A() NameError: global name '_A__A' is not defined Here I want to keep a list of instanciated objects of class __A, so I can update interna...

Access from one class to methode of other class
Hi, all! In my programm i have to insert a variable from class 2 to class 1 and I get error NameError: global name 'd' is not defined. How do I get access to d.entry.insert() method of class 1 class 1: self.entry = Entry(self.entryframe) self.entry.pack() self.button = Button(command = self.callclass2window) def callclass2window c = 2() class 2: def ins(self) d.entry.insert(variable) d = 1() I don't know if your're actually calling the classes '1' and '2', but that's a really bad idea! > class 2: > def ins(self) >...

Could an instance of a small class as a member of a bigger class access the bigger class's static variable?
I am making a simulation program in which I constructed 2 classes. A small one which describe a single atom (cls_atom), and a large one, which is the container of the simulation containing lots of atoms (cls_box). Therefore cls_atom will create thousands of instances as member of cls_box. Now there are lots of member variables of the cls_box needed to be shared by all instances of cls_atom. For example, temperature T, pressure P and total volume of the box, V, which is the global parameter for the sandbox and should be accessed by all atoms. Is there a way to authorize such access...

Access classes in Tomcat
Hallo everybody In Tomcat (Version 5.0) jsp files are usually placed under /webapps/[myWebApplication]/ . Under /webapps/[myWebApplication]/Web-INF/classes/ I have all my java classes. How can I access this classes from my JSP-File? Thanks Peter Peter H=F6ltschi wrote: > How can I access this classes from my JSP-File? Copying from the top of a .jsp I find somewhere on the disk: <%@ page language=3D"java" import=3D"jada.jada.*, java.util.*, more.stuff.*"%> Hope this helps. Harald. ...

Class.class and class.getClass, whats the difference
hi, Is Class.class different from instanceOfClass.getClass() ? I know it sounds blank. Let me explain the problem that I faced in detail; I have a class Class A with 2 protected methods and a private List object. Now in the test class of Class A, in a test case, I create a inner class for Class A and override the two protected methods of Class A.. In addition I try to set up data in the List using relection. i.e testMtd(){ A a = new A(){ // Code for two overriden protected mtds here }; Field f = A.class.getDeclaredField("NameOfTheListInClassA"); //This works Field f = a.getC...

why a class can't access protected method from another class in the same package,the method is interited from the ohtner class from differnt package?
package XX;class A{ protected void kk ();}package YY;import XX.A;class B extends A{}package YY;class C{ public void zz() { kk(); //why can call B.kk()???? }}but if we modify as below:package YY;import XX.A;class B extends A{ protected void kk () { super.kk(); }}why above modify can success?3ks <junzhang1983@gmail.com> wrote in message news:92be769e-b993-4daf-9c86-8252f5e83807@s12g2000prg.googlegroups.com...> package XX;> class A> {> protected void kk ();> }>> package YY;> import XX.A;>> class B extends A> {>&...

How to access a class member function outside of its class?
Being a newbie in C++ and comming from C, I can't find information on how to access a class member function outside its class. Below is a snippet of the class and its member function: look at "AddCallPages" ============================================================= class CPsnstatuspttView : public CFormView { protected: // create from serialization only CPsnstatuspttView(); DECLARE_DYNCREATE(CPsnstatuspttView) public: //{{AFX_DATA(CPsnstatuspttView) enum { IDD = IDD_PSNSTATUSPTT_FORM }; CEdit m_edit_msgs_ctrl; CString m_edit_messages; //}}AFX_DATA // Attributes publi...

Classes in a class: how to access variables from one in another
Hello. I have a class A that contains two classes B and C: class A: class B: self.x = 2 class C: Is there a way to access the x defined in B in class C? Thanks. -- F. Delente On 2010-10-18, <fab@slick.airforce-one.org> <fab@slick.airforce-one.org> wrote: > Hello. > > I have a class A that contains two classes B and C: > > class A: > class B: > self.x = 2 > > class C: > > Is there a way to access the x defined in B in class C? That's not valid Python code. Do you mean: Class A: Cl...

JNI accessing a class that instantiates another class
I'm taking my first stab at JNI. I have a main Java class that instantiates another class. In my C++ code, I am using the FindClass function for the main class and calling the method in the main class using GetStaticMethodId/CallStaticIntMethod. The C++ code is successfully finding the Java class and calling the method that I specified in the GetStaticMethoId function. The only problem is, when the Java class attempts to create an instance of this second, inner class, it dies. I don't get an error, it just doesn't work. My question is... Do I need another FindClass statement ...

How to access outer class attribute from nested class
Please see the following example. Is there any other way to access SomeAttribute from the nested class, without having to use the actual name of the outer class? class SomeClass: SomeAttribute = 1 class SomeNestedClass: SomeOtherAttribute = 2 def SomeNestedClassMethod(cls): print "%s%s" % ( SomeClass.SomeAttribute cls.SomeOtherAttribute, ) SomeNestedClassMethod = classmethod(SomeNestedClassMethod) Thanx I use something like: class SomeClass: SomeAttribute = 1 class S...