title: how to reload jsp page on every request?
body: <p>i have a jsp page with jdbc connection and on first load it shows the data accurately but after that it shows empty tables i think 2nd time it loads from memory not from server </p>
  
  <p>what is problem behind i don't know </p>
  
  <p>ok here are the details </p>
  
  <p>i have a servlet that maintains the session for a user that log in and then after creating the session the servlet redirect the user to a view page that is a jsp page and displays the existing records in DB </p>
  
  <p>when the servlet redirects the page the jsp can show the records in but when i access this page from any other html page it is unable to display the records here is the code for jsp page to view.</p>
  
  <pre><code>&lt;%@ page import="java.sql.ResultSet" %&gt;
  &lt;%@ page import="java.math.BigDecimal" %&gt;
  &lt;%@ page import="java.sql.SQLException" %&gt;
  &lt;%@ page import="java.util.logging.Level" %&gt;
  &lt;%@ page import="java.util.logging.Logger" %&gt;
  &lt;%@ page import="iEHR.cDBProcessor" %&gt;
  
  &lt;HTML&gt;
  &lt;HEAD&gt;
  &lt;TITLE&gt;View Patient&lt;/TITLE&gt;
  &lt;META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251"&gt;
  &lt;script type="text/javascript" language="javascript" src="datepicker/main.js"&gt;&lt;/script&gt;
                      &lt;script type="text/javascript" language="javascript" src="datepicker/prototype-1.js"&gt;&lt;/script&gt;
              &lt;script type="text/javascript" language="javascript" src="datepicker/prototype-base-extensions.js"&gt;&lt;/script&gt;
              &lt;script type="text/javascript" language="javascript" src="datepicker/prototype-date-extensions.js"&gt;&lt;/script&gt;
              &lt;script type="text/javascript" language="javascript" src="datepicker/behaviour.js"&gt;&lt;/script&gt;
              &lt;script type="text/javascript" language="javascript" src="datepicker/ratingbar.js"&gt;&lt;/script&gt;
                              &lt;script type="text/javascript" language="javascript" src="datepicker/datepicker.js"&gt;&lt;/script&gt;
                                          &lt;link rel="stylesheet" href="datepicker/datepicker.css"&gt;
                              &lt;script type="text/javascript" language="javascript" src="datepicker/behaviors.js"&gt;&lt;/script&gt;
  &lt;style type="text/css"&gt;
  &lt;!--
  img {
      border: none;
  }
  .tah10 {
      font-family: "Times New Roman", Times, serif;
      font-size: 14px;
      text-decoration: none;
      color: #000000;
      font-style: italic;
  }
  .tah11 {
      font-family: Tahoma;
      font-size: 11px;
      text-decoration: none;
      color: #000000;
  }
  .ver10 {
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size: 10px;
      text-decoration: none;
      color: #000000;
  }
  .ver11 {
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size: 11px;
      text-decoration: none;
      color: #000000;
  }
  .tah9 {
      font-family: Tahoma;
      font-size: 9px;
      text-decoration: none;
      color: #000000;
  }
  .ver9 {
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size: 9px;
      text-decoration: none;
      color: #000000;
  }
  td {
      vertical-align: top;
      color: 497B99;
      font-size: 12px;
      font-style: normal;
      font-weight: bolder;
  }
  --&gt;
  &lt;/style&gt;
  &lt;style type="text/css"&gt;
  &lt;!--
  .bgtop {
      background-repeat: repeat-x;
      background-position: top;
  }
  --&gt;
  &lt;/style&gt;
  &lt;style type="text/css"&gt;
  &lt;!--
  a {
      font-family: Times New Roman, Times, serif;
      font-size: 12px;
      font-weight: bolder;
      color: 467B99;
      text-decoration: none;
  }
  
  .datepicker{
      font-family: Times New Roman, Times, serif;
      font-size: 12px;
      font-weight: bolder;
      color: 467B99;
      text-decoration: none;
  }
  a:hover {
      font-size: 10px;
      font-weight: bold;
      color: FF8400;
  }
  .style1 {
      color: 467B99;
      font-family: Times New Roman, Times, serif;
      font-size: 12px;
      text-decoration: none;
      font-style: normal;
      font-weight: bolder;
  }
  .style2 {
      font-family: Times New Roman, Times, serif;
      font-size: 12px;
      font-style: normal;
      font-weight: bolder;
      color: 467B99;
      text-decoration: none;
  }
  --&gt;
  &lt;/style&gt;
  &lt;/HEAD&gt;
  &lt;BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0&gt;
  &lt;!-- ImageReady Slices (0005_red.psd - Slices: 03, 04, 05) --&gt;
  &lt;TABLE WIDTH=100% height="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0 bgcolor="#FFFFFF"&gt;
      &lt;TR&gt;
          &lt;TD width="12%"&gt; 
  &lt;TABLE WIDTH=159 BORDER=0 CELLPADDING=0 CELLSPACING=0&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=6&gt;
              &lt;IMG SRC="images/logo.gif" WIDTH=159 HEIGHT=128 ALT=""&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD&gt;
              &lt;IMG SRC="images/s1.gif" WIDTH=20 HEIGHT=20 ALT=""&gt;&lt;/TD&gt;
          &lt;TD&gt;
              &lt;A HREF="#"&gt;
                  &lt;IMG SRC="images/r1.gif" WIDTH=29 HEIGHT=20 BORDER=0 ALT=""&gt;&lt;/A&gt;&lt;/TD&gt;
          &lt;TD&gt;
              &lt;A HREF="#"&gt;
                  &lt;IMG SRC="images/r2.gif" WIDTH=31 HEIGHT=20 BORDER=0 ALT=""&gt;&lt;/A&gt;&lt;/TD&gt;
          &lt;TD&gt;
              &lt;A HREF="#"&gt;
                  &lt;IMG SRC="images/r3.gif" WIDTH=31 HEIGHT=20 BORDER=0 ALT=""&gt;&lt;/A&gt;&lt;/TD&gt;
          &lt;TD&gt;
              &lt;A HREF="#"&gt;
                  &lt;IMG SRC="images/r4.gif" WIDTH=28 HEIGHT=20 BORDER=0 ALT=""&gt;&lt;/A&gt;&lt;/TD&gt;
          &lt;TD&gt;
              &lt;IMG SRC="images/s2.gif" WIDTH=20 HEIGHT=20 ALT=""&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=6&gt;
              &lt;IMG SRC="images/s3.gif" WIDTH=159 HEIGHT=93 ALT=""&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=6&gt;
              &lt;IMG SRC="images/h1.jpg" WIDTH=159 HEIGHT=32 ALT=""&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=6&gt;
              &lt;IMG SRC="images/img1.jpg" WIDTH=159 HEIGHT=76 ALT=""&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=6&gt;
              &lt;IMG SRC="images/img2.jpg" WIDTH=159 HEIGHT=81 ALT=""&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=6&gt;
              &lt;IMG SRC="images/img3.jpg" WIDTH=159 HEIGHT=79 ALT=""&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
            &lt;TD COLSPAN=6&gt; &lt;IMG SRC="images/but1.jpg" ALT="" WIDTH=159 HEIGHT=42 border="0" usemap="#Map"&gt;&lt;/TD&gt;
      &lt;/TR&gt;
  &lt;/TABLE&gt;      &lt;/TD&gt;
          &lt;TD width="12%"&gt; 
  &lt;TABLE WIDTH=167 BORDER=0 CELLPADDING=0 CELLSPACING=0&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=2&gt;
              &lt;IMG SRC="images/h2.jpg" WIDTH=167 HEIGHT=25 ALT=""&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=2 background="images/bg1.gif" HEIGHT=94&gt;
  &lt;div style="padding:20;padding-top:5;padding-right:10;padding-bottom:0;color:ffffff" class="tah10"&gt;
  &lt;strong&gt;Noesis&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
   &lt;strong&gt;Inovative EHR Services &lt;/strong&gt; &lt;br&gt;
   &lt;br&gt;
  &lt;/div&gt;      &lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=2&gt;
              &lt;IMG SRC="images/s4.jpg" WIDTH=167 HEIGHT=52 ALT=""&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=2 background="images/bg2.gif"&gt;
  &lt;div style="padding-left:0px;padding-top:12px;padding-bottom:2"&gt;&lt;a href="AddPatient.jsp"&gt;&lt;span style="padding-left:20;padding-top:5"&gt;Add Patient &lt;/span&gt;&lt;/a&gt;&lt;/div&gt;      &lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=2 background="images/bg3.gif" HEIGHT=18&gt;
  &lt;div style="padding-left:20;padding-top:5"&gt;&lt;a href="AddPastMedicalHistory.jsp"&gt;Add Patient History&lt;/a&gt; &lt;/div&gt;       
  
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=2 background="images/bg4.gif" HEIGHT=18&gt;
  &lt;div style="padding-left:20;padding-top:5"&gt;&lt;a href="AddPatientInsurance.jsp"&gt;Add Patient Insurance&lt;/a&gt;&lt;/div&gt;        &lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=2 background="images/bg5.gif" HEIGHT=18 &gt;
  &lt;div style="padding-left:20;padding-top:5"&gt;View Patient Records&lt;/div&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=2 background="images/bg6.gif" HEIGHT=18 &gt;
  &lt;div style="padding-left:20;padding-top:5"&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;a href="AboutUs.jsp"&gt;About  Us&lt;/a&gt;&lt;/div&gt;        &lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=2 background="images/bg7.gif" HEIGHT=18 &gt;
  &lt;div style="padding-left:20;padding-top:5"&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;a href="ContactUs.jsp"&gt;Contact Us&lt;/a&gt;&lt;/div&gt;     &lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=2 background="images/bg8.gif" HEIGHT=18 &gt;
  &lt;div style="padding-left:20;padding-top:5"&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;/div&gt;       &lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=2&gt;
              &lt;IMG SRC="images/h3.gif" WIDTH=167 HEIGHT=65 ALT=""&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=2 background="images/bg9.gif" HEIGHT=94&gt;
  &lt;div style="padding:15;padding-top:3;padding-bottom:3;color:737373" class="tah10"&gt;&lt;/div&gt;        &lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=2&gt;
              &lt;IMG SRC="images/h4.jpg" WIDTH=167 HEIGHT=41 ALT=""&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD background="images/bg10.jpg" WIDTH=123 HEIGHT=32&gt;
            &lt;div style="padding-left:15;padding-top:1"&gt;
              &lt;input name="text" type="text" size="11"&gt;
            &lt;/div&gt;&lt;/TD&gt;
            &lt;TD width="44"&gt; &lt;IMG SRC="images/but2.jpg" ALT="" WIDTH=44 HEIGHT=32 border="0" usemap="#Map2"&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD COLSPAN=2&gt;
              &lt;IMG SRC="images/s5.jpg" WIDTH=167 HEIGHT=48 ALT=""&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
        &lt;TD COLSPAN=2&gt;&amp;nbsp;&lt;/TD&gt;
        &lt;/TR&gt;
  &lt;/TABLE&gt;      &lt;/TD&gt;
        &lt;TD width="72%"&gt; 
            &lt;table width=100% height="193" border=0 cellpadding=0 cellspacing=0&gt;
            &lt;tr&gt;
              &lt;td height=172 colspan="4" &gt;&lt;span class="bgtop"&gt;&lt;img src="images/f_m.jpg"&gt;&lt;/span&gt;&lt;/td&gt;
              &lt;td height=172 colspan="2" width="63%" background="images/bg_tile_1.gif" class="bgtop"&gt;&amp;nbsp;&lt;/td&gt;
            &lt;/tr&gt;
  
            &lt;tr&gt;
              &lt;td height=19 colspan="4" background="images/bg11.gif" &gt;&amp;nbsp;&lt;/td&gt;
            &lt;/tr&gt;
          &lt;/table&gt;
          &lt;%! private ResultSet rsResult; %&gt;
  
           &lt;%!   cDBProcessor DBProcess = new cDBProcessor(); %&gt;
  
  
  
          &lt;%
              DBProcess.ConnectTODB();
              if(request.getAttribute("dbrec") != null)
              {
                  rsResult = DBProcess.statement.executeQuery("SELECT * FROM patients");
              }//end if
              out.println("&lt;table border=\"0\"&gt;&lt;tr&gt;&lt;td valign=\"top\" &gt;");
              out.println("&lt;tr&gt;&lt;th&gt;Patient ID&lt;/th&gt;&lt;th&gt;First Name&lt;/th&gt;&lt;th&gt;Middle Name&lt;/th&gt;&lt;th&gt;Last Name&lt;/th&gt;&lt;th&gt;Gender&lt;/th&gt;&lt;th&gt;Marital Status&lt;/th&gt;&lt;th&gt;Phone No.&lt;/th&gt;&lt;th&gt;Address&lt;/th&gt;");
              out.println("&lt;th&gt;Date Of Birth&lt;/th&gt;&lt;th&gt;Last Date Of Exam&lt;/th&gt;&lt;th&gt;Status&lt;/th&gt;&lt;/tr&gt;");
  
              //data display on page
              if(rsResult!= null)
              {
                  try
                  {
                      while (rsResult.next())
                      {
                          BigDecimal bdPatientID = rsResult.getBigDecimal("patient_id");
                          String strFirstname = rsResult.getString("first_name");
                          String strLastname = rsResult.getString("last_name");
                          String strMiddlename = rsResult.getString("middle_name");
                          String strGeneder = rsResult.getString("gender");
                          String strMeritalStatus = rsResult.getString("marital_status");
                          BigDecimal bdPhoneNo = rsResult.getBigDecimal("phone_no");
                          String strAddress = rsResult.getString("address");
                          String strDOB = rsResult.getDate("birth_dt") == null ? "" : rsResult.getDate("birth_dt").toString();
                          String strDOE = rsResult.getDate("dt_of_exam") == null ? "" :rsResult.getDate("dt_of_exam").toString();
                          String strStatus;
                          Byte bPatientStatus= rsResult.getByte("status");
  
                          if(bPatientStatus == 1)
                          {
                              strStatus = "Active";
                          }//end if
                          else
                          {
                               strStatus = "Inactive";
                          }//end else
  
                         out.println("&lt;tr&gt;&lt;td&gt;"+bdPatientID+"&lt;/td&gt;&lt;td&gt;"+strFirstname+"&lt;/td&gt;&lt;td&gt;"+strMiddlename+"&lt;/td&gt;&lt;td&gt;"+strLastname+"&lt;/td&gt;");
                         out.println("&lt;td&gt;"+strGeneder+"&lt;/td&gt;&lt;td&gt;"+strMeritalStatus+"&lt;/td&gt;&lt;td&gt;"+bdPhoneNo+"&lt;/td&gt;&lt;td&gt;"+strAddress+"&lt;/td&gt;");
                         out.println("&lt;td&gt;"+strDOB+"&lt;/td&gt;&lt;td&gt;"+strDOE+"&lt;/td&gt;&lt;td&gt;"+strStatus+"&lt;/td&gt;&lt;/tr&gt;");
  
                      }//end while
                      out.println("&lt;/table&gt;");
                  }//end try
                  catch (SQLException ex)
                  {
                      out.println("&lt;I&gt;exception&lt;/I&gt;&lt;br&gt;");
  
                  }//end catch
              }//end if
  
          DBProcess.CloseDB();
          %&gt;
  
        &lt;/TD&gt;
          &lt;TD width="4%" background="images/bg_tile_1.gif" class="bgtop"&gt;&amp;nbsp;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD height="100%" colspan="4"&gt;&amp;nbsp;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD colspan="3"&gt;
  &lt;TABLE WIDTH=768 BORDER=0 CELLPADDING=0 CELLSPACING=0&gt;
      &lt;TR&gt;
          &lt;TD width="326"&gt;
              &lt;IMG SRC="images/s7.gif" WIDTH=326 HEIGHT=48 ALT=""&gt;&lt;/TD&gt;
          &lt;TD background="images/bg16.gif" WIDTH=442 HEIGHT=48&gt;
  &lt;div style="padding-top:12;color:A8A8A8" class="tah11"&gt;
  2010 © Copyright iAS. &lt;Br&gt;
  All rights Reserved. Read &lt;a href="#" style="color:467B99" class="tah11"&gt;Privacy Policy&lt;/a&gt;.&lt;/div&gt;      &lt;/TD&gt;
      &lt;/TR&gt;
  &lt;/TABLE&gt;        &lt;/TD&gt;
          &lt;TD width="4%" background="images/bg_tile_2.gif"&gt;&amp;nbsp;&lt;/TD&gt;
      &lt;/TR&gt;
  &lt;/TABLE&gt;
  &lt;!-- End ImageReady Slices --&gt;
  &lt;map name="Map"&gt;
    &lt;area shape="rect" coords="39,2,133,27" href="#"&gt;
  &lt;/map&gt;
  &lt;map name="Map2"&gt;
    &lt;area shape="circle" coords="9,12,9" href="#"&gt;
  &lt;/map&gt;
  &lt;/BODY&gt;
  &lt;/HTML&gt; 
  </code></pre>