tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Evans <dsev...@berndtgroup.net>
Subject RE: Accessing resource in WEB-INF outside servlet
Date Mon, 08 Nov 2004 14:32:24 GMT
Ok, thanks i will look into the getResource configuration method, it
sounds like that would subsitute for the JNDI lookup cleanly. So one
last thing, if you've got the time. You said:
"Having each Bean get its own connection path itself is not clean, but
it's your design, so it's up to you." 
so how do you handle this? do you pass in the connection info to every
DAO method, like this:
public static Book getBook(String connection, String bookId)
public static void updateBook(String connection, Book book)

that seems tedious, and since the all of my database
interaction is encapsulated in the DAOs, it seems unclean to 
reference the connection anywhere else. 

again, thanks for your help thus far.

dave

On Mon, 2004-11-08 at 09:21, Shapira, Yoav wrote:
> Hi,
> 
> >public static Book getBook(String bookId)
> >public static void updateBook(Book book)
> >
> >So in order to preserve that cleanliness, the methods have to get the
> >connection path themselves, which was why i was so excited by the JNDI
> >lookup.
> 
> Having each Bean get its own connection path itself is not clean, but
> it's your design, so it's up to you.  You can use the other approach
> mentioned (but shunned) by the original poster, which is to put said
> configuration information on the classpath.  Then each of your classes
> can get getClass().getResource("/myConfigFile.prop") to get the
> configuration.  That's much more testable and portable, doesn't depend
> on a container, doesn't depend on the Servlet API.
> 
> Yoav
> 
> 
> 
> This e-mail, including any attachments, is a confidential business communication, and
may contain information that is confidential, proprietary and/or privileged.  This e-mail
is intended only for the individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the sender.  Thank you.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


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


Mime
View raw message