title: Pass value from one JSP page to another JSP page and get response data back from First JSP
body: <p>Below is my <code>first.jsp</code> from which I am supposed to call <code>second.jsp</code> page using AJAX... And I need to pass a value from <code>first.jsp</code> page to <code>second.jsp</code> page. </p>
  
  <p>And then in the <code>second.jsp</code> page use that variable value and make a SELECT query using that and return the data back to <code>first.jsp page</code></p>
  
  <p>Below is my <code>first.jsp page</code></p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
      &lt;/head&gt;
      &lt;body&gt;    
          &lt;p&gt;&lt;input type="radio" name="dish" value="Indian" id="radioButton"&gt; Continental&lt;/input&gt;&lt;/p&gt;
          &lt;p&gt;&lt;label for="male" id="columnData"&gt;Male&lt;/label&gt;&lt;/p&gt;    
          &lt;script&gt;
              $(document).ready(function() {
                  $('#radioButton').click(function() {
                      alert($('#columnData').html());
                      var name = $('#columnData').html();             
                      $.ajax({  
                          type:"POST",      
                          url: "second.jsp",  
                          data:"name=" +name,           
                          success: function(success) {                                  
                          }  
                      });                 
                  });
              });
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Below is my <code>second.jsp page</code> in which I need to retrieve the value from <code>first.jsp</code> and make a select query and return the result back..</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;SELECT Operation&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;sql:setDataSource var="snapshot" driver="org.postgresql.Driver"
                         url="jdbc:postgresql://localhost/postDB"
                         user="postgres"  password="hello"/&gt;
  
      &lt;sql:query dataSource="${snapshot}" var="result"&gt;
          // use the name variable value here passed from first.jsp page?
          SELECT * from Employees where name = ?;
      &lt;/sql:query&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I am not sure how to pass the value from one JSP page to another JSP page and then return back the result from second.jsp page to first.jsp page?</p>