Re: How to access the Struts Connection Pool from an ActionForm

"V. Cekvenich" <[email protected]>
Newsgroups gmane.comp.java.mvc.devel
Message-ID <[email protected]>
A good practice is to unit test the beans before using them, since that 
is one of the benefits of MVC.
So before the action, test the bean, including the option bean, 
basically an iteration of names and properties.
Then add a toCollection method that returns .... the collection so you 
can use Options Collection.

hth,
.V

Steven Citron-Pousty wrote:
> 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]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.