aspose file tools*
The moose likes JSP and the fly likes Show Manager list based on Department. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Show Manager list based on Department." Watch "Show Manager list based on Department." New topic
Author

Show Manager list based on Department.

Nash kumar
Greenhorn

Joined: Sep 23, 2012
Posts: 20


I am trying to show list of Managers based on Department selected from a dropdown. I have written the below code. But Department list is duplicated many time(as many as number of managers for that department) and not showing the values in textarea based on department selected. how to achieve this?



jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

Hi Nash,

Its wrong to have everything in jsp. You separate the for connection and getting the result from the db but as far as your problem is concern check the results of the query first.

Regards
Jatan

Nash kumar
Greenhorn

Joined: Sep 23, 2012
Posts: 20
Thanks for your response. I am aware that not to put the JAVA code in JSP. I put it to explain my issue better. As for Query is concerned, it shows list of Manager Names in one column and Departments in other column.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61658
    
  67

Nash kumar wrote:Thanks for your response. I am aware that not to put the JAVA code in JSP. I put it to explain my issue better.

As you can see, that approach is flawed. All it's doing is to confuse the issue. Post real code.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nash kumar
Greenhorn

Joined: Sep 23, 2012
Posts: 20
Real code consist of values from different files. If you can provide a demo of two drop downs and first having Department list and second Managers list. The second should display the Managers from that department. This will be helpful.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61658
    
  67

Examples of this using Ajax are all over the web. Please do a search for "cascading dropdowns" or "dependent dropdowns".
Nash kumar
Greenhorn

Joined: Sep 23, 2012
Posts: 20
Thanks Bear Bibeault. I did research about this issue in google earlier. However, your suggestion of using the proper keywords in Google search helped me in finding the solution. I appreciate your help.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61658
    
  67

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Show Manager list based on Department.