struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shaun Whyte" <swh...@opaltelecom.co.uk>
Subject Using Data-source's with Struts
Date Wed, 24 Jul 2002 11:45:43 GMT
I am trying to find a good way of using the data sources within a Stuts
application.

Supposing I have some Manager classes (like Facades); each of which have
methods which perform a set of related use-cases, which abstract complexity
of communicating with the beans.  The idea being that a Struts Action class
would use the manager classes to perform the detailed operations, and
therefore not only can a Stuts Action class use the facades (manager
classes), but any other class which needs to perform the same functionality
can also use them (e.g. it may not be an HTTP request).  My manager classes
are created in a sub-class of ActionServlet and stored in the servlet
context for use by Struts actions.  If it is not a Struts application which
is not using them, then they are created in some other way.

With regards to the DataSources, supposing my manager class needs to use
data-source(s).  I don't want my manager classes to be tied to HTTP, so I
don't want them to look in the ServletContext for the data source, which is
where Struts stored them.

Is the best solution, to create a List of the DataSource object in my
sub-class of ActionServlet, then when I create the managers, just pass in
the list for them to use.  That way, if another type of application which
needs to use the managers (which isn't using Struts), it would create the
DataSources itself, put them in a list, and, similar to my ActionServlet,
pass them in to the manager classes when it created them.

If anyone has any ideas for me, or if this is a good way of doing things,
please reply.

Also as a second question, I have been looking at the JavaDoc's for the JDBC
Connection Pool (from bitmechanic.com), and cannot find a class which
implements javax.sql.DataSource to use within Struts, is this correct?

Many thanks!

Shaun.


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message