title: autocomplete error coming in jsp/ajax
body: <p>//<strong>index.jsp</strong></p>
  
  <pre><code>&lt;html&gt;
   &lt;head&gt;
   &lt;title&gt;JSP page&lt;/title&gt;
  &lt;script="text/javascript"&gt;
  $(function() {
  // subscribe to the keydown event
  $('#text1').keydown(function(e) {
      // when a key is pressed check if its code was 9 (TAB)
      if (e.which == 9) {
          // if TAB was pressed send an AJAX request
          // to the server passing it the currently 
          // entered value in the first textbox
          $.ajax({
              url: '/someservlet/',// i have created a servlet named as someservlet
              type: 'POST',
              data: { value: $(this).val() },
              success: function(result) {
                  // when the AJAX succeeds update the value of the 
                  // second textbox using the result returned by the server
                  // In this example we suppose that the servlet returns
                  // the following JSON: {"foo":"bar"}
                  $('#text2').val(result.foo);
              }
          });    
      }
  });
  });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;input type="text" id="text1" name="firsttextbox"/&gt;
  &lt;input type="text" id="text2" name="secondtextbox"/&gt;
  &lt;body&gt;
  </code></pre>
  
  <p>//<strong>do post() someservlet</strong></p>
  
  <pre><code>String dd = request.getParameter("firsttextbox"); 
  String json = new Gson().toJson(options);
  response.setContentType("application/json");
  response.setCharacterEncoding("UTF-8");
  response.getWriter().write(json);
  </code></pre>
  
  <p>Do i need to import any js file inside head block? Can anyone tell me where i am wrong? While compiling i am getting the jsper...error. Same code is working in fiddle: </p>
  
  <p><a href="http://jsfiddle.net/JLJ3f/" rel="nofollow">http://jsfiddle.net/JLJ3f/</a> </p>
  
  <p>While compiling in netbeans, i am getting error.</p>
  
  <p>Any help is appreciated.</p>