title: jsp calls 2 servlets through jquery
body: <p><strong>Background:</strong>
  i have - Search.jsp, SearchResult.java and SearchDetails.java files. i need to post the search values to the SearchResult servlet via jquery/(ajax?) on form submit and display the result in a 1-column table.
  after that user can click on any row to view that result's details in the same page. in this case my plan is to on click event of the specific row i have to call SearchDetails servlet via jquery-ajax.</p>
  
  <p><strong>Problem:</strong>
  i can now get the search result within a dynamically populated table and within each row i am populating the result within a /link tag.
  1. pls tell me how the result can be populated in a table so that i can do the pagination, etc.
  2. how can i call the SearchDetails servlet with a hidden value stored in a dynamically populated td.</p>
  
  <p><strong>My Experience:</strong> i am working on jsp, servlet, jquery-ajax from last 1 month. but did .net last 7 yrs. </p>
  
  <p>Search.jsp: </p>
  
  <pre><code>&lt;script&gt; 
   $(document).ready(function() { 
       $('#btnSearch').click(function() { 
          $mobileNo = document.getElementById("txtMobileNo").value;
          $.post('BE_AccountSearch', {mobileNo:$mobileNo}, 
          function(responseText){ 
                $('#dvSearchResultSub').html(responseText); 
           }); 
       }); 
   }); 
  &lt;/script&gt; 
  &lt;form id="form" method="post"&gt; 
       &lt;input name="txtMobileNo" id="txtMobileNo" autofocus&gt; 
       &lt;input type="button" id="btnSearch" value="Search"/&gt; 
       &lt;div id="dvSearchResultSub"&gt;&lt;/div&gt; 
  &lt;/form&gt; 
  </code></pre>
  
  <p>SearchResult.java (servlet): </p>
  
  <pre><code>out.println("&lt;table&gt;"); 
  for (int i = 0; i &lt; memberList.size(); i++){ 
    out.println("&lt;tr&gt;"); out.println("&lt;td&gt;"); 
    out.println("&lt;a id=\"memberList\" href=\"BE_AccountDetails?uln=" + memberList.get(i).getUsername() + "\"&gt;"); 
    out.println(memberList.get(i).getUsername());
    out.println("&lt;/a&gt;"); 
    out.println("&lt;/td&gt;"); 
   out.println("&lt;/tr&gt;"); 
  } 
  out.println("&lt;/table&gt;"); 
  out.println("&lt;/div&gt;"); 
  out.flush(); 
  out.close(); 
  </code></pre>