title: Transfer variable value from 1 jsp page to another jsp age
body: <p>I am using MYSQL database and for programming I am using JSP. Now I am extracting a value from database in my result.jsp page using this code:</p>
  
  <pre><code>String pid="";
  while(resultSet.next()
  {
  &lt;form action="report.jsp"&gt;
  &lt;%=resultSet.getString("patient_id") %&gt;
  &lt;% pid=resultSet.getString("patient_id"); %&gt;
  &lt;% request.setAttribute("acId", "pid"); %&gt; 
  &lt;input type="submit"&gt;&lt;/input&gt;
  &lt;/form&gt;
  }
  </code></pre>
  
  <p>pid is a variable used to store the value of Patient ID.</p>
  
  <p>I want to transfer that value to another jsp page which is report.jsp </p>
  
  <p>I am retrieving the value in repost.jsp as follows:</p>
  
  <pre><code>&lt;%
  String paid = (String)(request.getAttribute("acId"));
  %&gt;
  </code></pre>
  
  <p>Then I have to store this value in database. But no value is being tranferred and stored in the variable paid. </p>
  
  <p>I have also seen <a href="https://stackoverflow.com/questions/19713016/send-value-from-1-jsp-to-another-jsp">this question</a> but got no help.</p>
  
  <p>Please ignore any errors as I am new to MYSQL and JSP.</p>