How to access the Struts Connection Pool from an ActionForm
Steven Citron-Pousty <[email protected]>
| Newsgroups | gmane.comp.java.mvc.devel |
|---|---|
| Organization | Basebeans.com |
| Message-ID | <[email protected]> |
Greetings all:I am trying to populate the options for a select list from a DB call. And I am getting a null pointer exception from this line in the ActionForm:To: [email protected] DataSource dataSource = (DataSource) servlet.getServletContext().getAttribute(Action.DATA_SOURCE_KEY);To: [email protected] What I am trying to do is use the ConnectionPool provided by Struts. This call works great in my Action but doesn't work in my ActionForm.On the IRC channel (irc.freenode.net #struts) we have been discussing the merits of putting a DB call in an ActionForm.To: [email protected] SOoo, my main question is,How do I ask the context for the connection pool in an ActionForm?To: [email protected] But I would also love to see discussion about the merits of putting a DB call in an ActionForm at all. If I didn't put the call in the ActionForm how would I get the data from the DB call into the actionForm?To: [email protected] Thanks in advance for all your help,SteveTo: [email protected]