• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How do I alter my dropdown menu?

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
}
%>
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic