Re: jdbc servlets and jsp
От | Paul Thomas |
---|---|
Тема | Re: jdbc servlets and jsp |
Дата | |
Msg-id | 20030908230524.A1608@bacon обсуждение исходный текст |
Ответ на | jdbc servlets and jsp (Luke Vanderfluit <luke@chipcity.com.au>) |
Ответы |
Re: jdbc servlets and jsp
|
Список | pgsql-jdbc |
On 08/09/2003 20:52 Luke Vanderfluit wrote: > Hi, > > I'm having a few probs (fun) getting jdbc to work in servlets and jsp, > tomcat in other words. > > I've successfully got jdbc working with postgresql in a regular java > class. > > I have tried using the same code adapted to a servlet and jsp to get a > database connection happening from there, however no luck, > > Is there anything I need to set up in server.xml or web.xml before it > can work? [snip] I'm not sure why you would want to load the JDBC driver in your JSP. JSPs are part of the view layer. Your JDBC stuff should be way back in the persistence layer. Even servlets are really too far forward for this - use then more as controllers. Personally, I use JSP/Struts for the view/controller and obtain back-end connections using JNDI. The datasource name is provided as a servlet parameter in web.xml and is passed to the data layer on session creation. You might find it useful to look at the j2ee design patterns at java.sun.com. HTH -- Paul Thomas +------------------------------+---------------------------------------------+ | Thomas Micro Systems Limited | Software Solutions for the Smaller Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +------------------------------+---------------------------------------------+
В списке pgsql-jdbc по дате отправления: