This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes How do I alter my dropdown menu? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How do I alter my dropdown menu?" Watch "How do I alter my dropdown menu?" New topic
Author

How do I alter my dropdown menu?

Fritz Largosa
Ranch Hand

Joined: Sep 12, 2005
Posts: 70
I am wanting to create a JSP method which dynamically changes my dropdown menu, so I can dynamically populate my dropdown menu depending on the user's inputs.


-----------------------------------------------
<form name="form1" method="post" action="" >
<select name="select" >
<option>Option1</option>
<option>Option2</option>
...I want to dynamically change this dropdown menu...
</select>
</form>

<%
public void Alter_dropdownmenu(){
//How do I alter the dropdown menu above?
}
%>
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

You basically have 2 options.

1. When the form is submitted you will need to populated some collection object with the values for the dropdown list and populate the dropdown using JSTL (or scripts if you have to).

2. Use Javascript.

Option 1 will require you to re-write how your dropdown is rendered. Option 2 doesn't belong in this forum.

If you search this forum and the javascript forum, you'll find that this is a very common question which has been answered on numerous occasions. So other than...

//How do I alter the dropdown menu above?

...what have you tried?


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I alter my dropdown menu?