You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Bailey, Shane C." <SH...@saic.com> on 2003/05/23 22:41:55 UTC

Philisophical Question

 

Why is there any reference to data-sources in the struts-config

dtd?

 

I mean, I agree with the notion that the Action is not part of the

model (especially since the request & response is passed in)

and that means that if you mess with data-sources in an Action 

then it is similar to (but not quite as bad I suppose) to accessing

the database from a JSP.

 

Shouldn't any data base access code be in a Session (as in

EJB Session or equivalent)?

 

 

 

 

 

 


Re: Philisophical Question

Posted by Ted Husted <hu...@apache.org>.
When we put in the DataSource registry, the interface was still rather 
young that there were not many concrete implementations. There was also 
not yet a place like the Jakarta Commons, where useful knick-knacks like 
the Struts datasource registry could live.

We are backing out our implementation of the datasource manager after 
Struts 1.1, since there are now several concrete implementations.

The datasources element creates a simple registry for datasource 
objects. It does not contain any data access code. You register some 
datasource with the manager and later retrieve it by name.

A good way to design a business/system layer is so that it is 
self-contained. But some older designs can expect a connection or 
datasource to be passed to it. Some containers also provide a datasource 
registry, but for those that do not, the Struts registry is available.

In the end, it doesn't cost much, and can be useful to some application 
designs.

-Ted.

Bailey, Shane C. wrote:
> Why is there any reference to data-sources in the struts-config
> dtd?
> 
> I mean, I agree with the notion that the Action is not part of the
> model (especially since the request & response is passed in)
> and that means that if you mess with data-sources in an Action 
> then it is similar to (but not quite as bad I suppose) to accessing
> the database from a JSP.
> 
> Shouldn't any data base access code be in a Session (as in
> EJB Session or equivalent)?


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



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