File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Populating dropdown box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Populating dropdown box" Watch "Populating dropdown box" New topic
Author

Populating dropdown box

El Roy Cabildo
Greenhorn

Joined: Oct 19, 2002
Posts: 23
I have a problem, i have two dropdown box when a user select the first dropdown box. the second dropdown box will be populated with data without affecting other controls in the form.
Example the first dropdown box is populated a list of department, so when the user selects a department the second combo box will be populated the list of employees belonging to that department that was selected by the user on the first drop down box without affecting other controls in the form?
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4447
    
    5

This can be done with JavaScript. See this example
BTW, your name is very familiar. You aren't by any chance an Iliganon, are you?
El Roy Cabildo
Greenhorn

Joined: Oct 19, 2002
Posts: 23
nope. im from cebu and you? thanks anyway.
El Roy Cabildo
Greenhorn

Joined: Oct 19, 2002
Posts: 23
the second dropdown box should be populated by the data from the database.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4447
    
    5

If the second dropdown gets data from the db, you'll probably still want to use javascript. Your first drop down would have an onchange event. In the event handler, you'll have to submit the form with document.forms[0].submit() Process the request and populate the bean that will be used to display the options for the second dropdown.
Here's a tutorial that shows how to use the Struts select/options tags.
Iliganon. I studied in USC Talamban for a year though.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populating dropdown box
 
Similar Threads
drop down box using struts
Problems with Action Errors in Struts
JSF dropdown components problem
Dynamic select boxes
Populating child menu based on parent menu in datatable