troubleshooting Question

dynamic drop down menu

Avatar of Raftor
Raftor asked on
JSP
10 Comments1 Solution253 ViewsLast Modified:
Hi experts,

I want to be able to display a dynamic drop down menu.  The number of employees in a
certain department can change so i want the drop down menu to display the employees
who are in that department at any particular time.

This is the code im using to extract the surname of the employees in the table who work in
our operations area.

------------------------------------------------------
ResultSet rs = stmt.executeQuery("SELECT userSName FROM userdetails WHERE dept LIKE 'Operations'");
int cnt = 0;
while(rs.next())
{
      cnt += 1;
                                    
      userSName = rs.getString(1);      

      %>
            <select onChange="if(this.options[this.selectedIndex].value)  top.location.href=(this.options[this.selectedIndex].value)">
               <option value=""> <% out.print(userSName); %> </option>
            </select>
      <%                              
}

%>
----------------------------------------------------------
The problem is that it is displaying a drop down menu for each employee with only their
name in that menu.
How can i overcome this problem and display just the members extracted from the table who
work in operations in the drop down menu.

Regards,
Raftor....
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros