struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent Berruchon <>
Subject Using data-source with ActionForm
Date Fri, 20 Sep 2002 10:19:02 GMT
I'm a newbie with Struts, I'd like to know how I could smartly use 
data-source to fill things like "select" drop down combo in my forms.

here what I'm trying to do, can you tell me if I'm wrong:

I'v defined a data-source in struts-config.xml to use a mySql DB.
I'd like to get data from this DB to fill inputs fields in my forms.

So I suppose I could get a connection in data-source pool in each of the 
                    "getMyProperty" of my actionForm methods and get the 
data that will fill HTML/JSP input...

something like that:
    DataSource dataSource = (DataSource)
    Connection conn = dataSource.getConnection();

but it seems to be a bit expensive to get a connection in each "getXXX" 
methods...(i'll do the same things several times for one actionForm 
use/1 request) where can I place the getConnection to use it in methods 
of my actionForm (1 connection for 1 actionForm use/1 request)

Tell me if there's something I didn't understand.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message