How to get select option value from javascript to jsp -
my html having selection option value box,if select option box ,i value in javascript want value in jsp because using string showing selected rows database,i tried request.getparameter didn't work code:
<script type="text/javascript"> function getappid() { var value=document.getelementbyid("planeselect").value; document.getelementbyid("demo").innerhtml="application id:"+value; } </script> <select id="planeselect" onchange="getappid()"> <% set<string> set=appslist.keyset(); (string s:set) { string appname = (string) appslist.get(s); %> <option value="<%=s%>"><%=appname%></option> <% } %> </select>
on change can load page , use request.getparameter()
<script type="text/javascript"> function getappid() { var value=document.getelementbyid("planeselect").value; document.getelementbyid("demo").innerhtml="application id:"+value; window.location="url_of_this_page?requiredvalue="+value; } </script> <% string valuerequired=request.getparameter("requiredvalue"); if(valuerequired!=null){ *****operation want perform***** } %> <select id="planeselect" onchange="getappid()"> <% set<string> set=appslist.keyset(); (string s:set) { string appname = (string) appslist.get(s); %> <option value="<%=s%>"><%=appname%></option> <% } %> </select>
Comments
Post a Comment