I have been out of touch with coding for a while. i would like to know the best design to the following problem
I have a class that implements soap client. It is basically used for executing sql statements or store procedures.
I want to use this class in the struts servlet.
Can you please suggest best way to use this class.
Thanks
d_luthra
-
design quest:control the creation of object used in servlet (4 messages)
- Posted by: Dimple Malhotra
- Posted on: December 06 2004 16:15 EST
Threaded Messages (4)
- design quest:control the creation of object used in servlet by Padmanabh Kulkarni on December 08 2004 10:35 EST
- go Struts! by Benjamin Possolo on December 14 2004 14:06 EST
- thank You by Dimple Malhotra on December 17 2004 14:55 EST
- Spring Framework by Georgy Jacob on December 18 2004 10:52 EST
- thank You by Dimple Malhotra on December 17 2004 14:55 EST
-
design quest:control the creation of object used in servlet[ Go to top ]
- Posted by: Padmanabh Kulkarni
- Posted on: December 08 2004 10:35 EST
- in response to Dimple Malhotra
Let me get this right, u have a soap client that makes DB connection directly? or cud u explain it in a more clear way? -
go Struts![ Go to top ]
- Posted by: Benjamin Possolo
- Posted on: December 14 2004 14:06 EST
- in response to Dimple Malhotra
im assuming u want to use an instance of this business object in ur Struts Actions.
well u have two options.
1) manually create a servlet or plugin that gets loaded on container startup and stores an instance of your business object class in ServletContext. then in ur Struts Actions you just
getServletContext().getAttribute("soapClientObject") and use it accordingly.
2) use Spring. Spring's WebApplicationContext is basically a lightweight JNDI. it does most of the work for you of creating an instance of your object and putting it in a WebApplicationContext (which you in turn retrieve from ServletContext).
if you only have one object you need to access/share between Struts Actions, the first approach may be better. but if you plan on scaling in the future at all id definitely start using Spring's IoC features. -
thank You[ Go to top ]
- Posted by: Dimple Malhotra
- Posted on: December 17 2004 14:55 EST
- in response to Benjamin Possolo
It is a good idea. Can you please give me more information about Spring? How to download it? Never heard of it before.
Does it create multiple instances to scale better. -
Spring Framework[ Go to top ]
- Posted by: Georgy Jacob
- Posted on: December 18 2004 22:52 EST
- in response to Dimple Malhotra
Search google for "spring framework" :)
(actually quite a bit of Spring documentation is right here on TSS)