Hello Allen,

Thursday, March 15, 2001, 10:52:00 AM, you wrote:

AA> I ran into the same problem and found the only good solution was to take
AA> a look at my custom classes and strip away what was "custom" about them
AA> and only save core Java objects to the context.  When I need my custom
AA> class, I create an instance of it and pass the references to the core
AA> Java objects saved in the context to the class in the constructor so
AA> that it is pointing to the objects in the shared context.  There are
AA> some limitations to this, but it works in all situations given a little
AA> thought.  Let me know if you need more clarification.

Thanks.

Foe example, I have the following objects

public class City {
       private String _name;
       private int    _population;

       ...
       getters/setters
       ...
}

and

public class State {
       private City[] _cities;

       ...
       getters/setters
       ...
}

What is the best way to "share" State object between servlets?

As I understand, your solution is to split "custom" objects on "core"
objects.

It means I should put into context at least one String and one Integer
objects for each of my City object. Of course, it will work. But if I
have several thousands of cities? Each should have unique name in
the context. And how to get them from context? Parse names? For each
request? May be I will test it with profiler, but it seems good
solution for small amount of objects.

Anyway, thanks for this help.

-- 
Best regards,
 Andrey                            mailto:[EMAIL PROTECTED]


Reply via email to