Set selected value from JSP dropdown -


i'm trying narrow down why i'm unable print or set selected value string dropdown menu i've wrapped jsp code around.

i'm able display dynamic filelist dropdown options successfully, i'm unable figure out how can set selected value in order pass down dynamic jsp lists based on file selection. found few suggestions on topic i've tried out below, i'm curious if there's more being dropdown list generated dynamically?

for i'm testing out println verify whether "environment" string being set after selection has been made.

<select id="environment" name="environment_drop" onchange="document.productform.submit();"> <% string path = filepath + "\\config"; // directory path here                      string f;                     file folder = new file(path);                     file[] listoffiles = folder.listfiles();                      (int = 0; < listoffiles.length; i++) {                         if (listoffiles[i].isfile()) {                             f = listoffiles[i].getname();                             out.println("<option value=" + f + ">" + f + "</option><br>");                         }                     }                    %> </select> <span></span> </section> <%         string[] environment = request.getparametervalues("environment");         out.println(environment); %>         <script>         document.getelementbyid("environment_drop").value = '<% out.print(environment); %>';         </script> 


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -