how to get the value from javascript code to jsp scriptlet with in the same jsp page -


below code (1.jsp)

<html> <head>   <script type="text/javascript">     function changefunc() { var selectbox = document.getelementbyid("selectbox"); var selectedvalue = selectbox.options[selectbox.selectedindex].value;   document.write("\n value is"+selectedvalue);   }   </script> </head>  <body> <form method="post" action="sampservlet">   <select id="selectbox" name="selurl" onchange="changefunc();">    <option value="1">option #1</option>    <option value="2">option #2</option>   </select> </form>  </body> </html> 

here have inserted code jsp page.and getting value of "selectedvalue" javascript scriptlet in same jsp this.

<% string val=(string)request.getparameter("selurl"); system.out.println("\n selected value is:"+val); %> 

i getting selected value null output. , if print javascript selectedvalue parameter giving me correct output i.e.,output option selected.but in scriptlet getting null.where error.i included headers , directives.please me.

in web browser have html, javascript , css. jsp code meant run on server. output of jsp file. , after cannot change jsp code.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -