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 drop down box using struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "drop down box using struts" Watch "drop down box using struts" New topic
Author

drop down box using struts

Chris Johnson
Greenhorn

Joined: Dec 07, 2004
Posts: 4
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 theuser 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 dropdown box without affecting other controls in the form?
Both dropdown box get the data from the database.

Can some one show me how to do this?

Thanks very much.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4445
    
    5

"pfcbuilder pfcbuilder"

Please edit your profile so that your publicly displayed name complies with the JavaRanch Naming Policy. Thank you for your cooperation.


Junilu - [How to Ask Questions] [How to Answer Questions]
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4445
    
    5

There are at least two ways to do this:

1. Call a JavaScript function in the onchange event of the first dropdown. This means that you will have to create JavaScript arrays that will hold all the possible combinations.

2. Submit the form via a JavaScript function call in the onchange event. In the backend, detect what the selected item was in the first drop down and then re-populate the options collection for the second drop down accordingly.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: drop down box using struts
 
Similar Threads
JSF dropdown components problem
Dynamic select boxes
Ajax Anywhere out of memory problem....
Populating dropdown box
Fire input text event Without Loosing Focus