I've come across this in a few difference manifestations and the best
course of action I've come across is dependant on the number of variations.

If you're only talking about a couple of hundred or less, use a javascript
array to populate the second dropdown on the fly.

If you're dealing with more than that [6,000 in my case :)] then you're
better
off using an onChange event handler on the first dropdown to submit the page
back to itself and use the action to generate the 2nd one from the database.
By default, I set the first dropdown to the 1st value and populate the 2nd
one based on that selection.

HTH

Colm

-----Original Message-----
From: Nilesh [mailto:[EMAIL PROTECTED]
Sent: 12 February 2004 05:50
To: Struts Users Mailing List
Subject: Populating a Listbox


I need to populate some lisbox from database at runtime.
Also, there are situations when I populate one list box depending upon the
value selected in another listbox, all from database.

I am using DBCP to connect to mySQL

1)Are there any special tags available in Struts?

2)Can any one suggest a most efficient method to do this, so that there is
minimum fetching from database.

Also please let me know the syntax of populating the listbox and the event
on which it is to be populated, since I have never done it before.
A small sample code(If you have tried it earlier) would help more.

Thanks in advance.
Nilesh.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to