Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1073229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:57:58+00:00 2026-05-16T20:57:58+00:00

i have a jsp page with jdbc connection and on first load it shows

  • 0

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

what is problem behind i don’t know

ok here are the details

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

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.

<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.math.BigDecimal" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="java.util.logging.Level" %>
<%@ page import="java.util.logging.Logger" %>
<%@ page import="iEHR.cDBProcessor" %>

<HTML>
<HEAD>
<TITLE>View Patient</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">
<script type="text/javascript" language="javascript" src="datepicker/main.js"></script>
                    <script type="text/javascript" language="javascript" src="datepicker/prototype-1.js"></script>
            <script type="text/javascript" language="javascript" src="datepicker/prototype-base-extensions.js"></script>
            <script type="text/javascript" language="javascript" src="datepicker/prototype-date-extensions.js"></script>
            <script type="text/javascript" language="javascript" src="datepicker/behaviour.js"></script>
            <script type="text/javascript" language="javascript" src="datepicker/ratingbar.js"></script>
                            <script type="text/javascript" language="javascript" src="datepicker/datepicker.js"></script>
                                        <link rel="stylesheet" href="datepicker/datepicker.css">
                            <script type="text/javascript" language="javascript" src="datepicker/behaviors.js"></script>
<style type="text/css">
<!--
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;
}
-->
</style>
<style type="text/css">
<!--
.bgtop {
    background-repeat: repeat-x;
    background-position: top;
}
-->
</style>
<style type="text/css">
<!--
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;
}
-->
</style>
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<!-- ImageReady Slices (0005_red.psd - Slices: 03, 04, 05) -->
<TABLE WIDTH=100% height="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0 bgcolor="#FFFFFF">
    <TR>
        <TD width="12%"> 
<TABLE WIDTH=159 BORDER=0 CELLPADDING=0 CELLSPACING=0>
    <TR>
        <TD COLSPAN=6>
            <IMG SRC="images/logo.gif" WIDTH=159 HEIGHT=128 ALT=""></TD>
    </TR>
    <TR>
        <TD>
            <IMG SRC="images/s1.gif" WIDTH=20 HEIGHT=20 ALT=""></TD>
        <TD>
            <A HREF="#">
                <IMG SRC="images/r1.gif" WIDTH=29 HEIGHT=20 BORDER=0 ALT=""></A></TD>
        <TD>
            <A HREF="#">
                <IMG SRC="images/r2.gif" WIDTH=31 HEIGHT=20 BORDER=0 ALT=""></A></TD>
        <TD>
            <A HREF="#">
                <IMG SRC="images/r3.gif" WIDTH=31 HEIGHT=20 BORDER=0 ALT=""></A></TD>
        <TD>
            <A HREF="#">
                <IMG SRC="images/r4.gif" WIDTH=28 HEIGHT=20 BORDER=0 ALT=""></A></TD>
        <TD>
            <IMG SRC="images/s2.gif" WIDTH=20 HEIGHT=20 ALT=""></TD>
    </TR>
    <TR>
        <TD COLSPAN=6>
            <IMG SRC="images/s3.gif" WIDTH=159 HEIGHT=93 ALT=""></TD>
    </TR>
    <TR>
        <TD COLSPAN=6>
            <IMG SRC="images/h1.jpg" WIDTH=159 HEIGHT=32 ALT=""></TD>
    </TR>
    <TR>
        <TD COLSPAN=6>
            <IMG SRC="images/img1.jpg" WIDTH=159 HEIGHT=76 ALT=""></TD>
    </TR>
    <TR>
        <TD COLSPAN=6>
            <IMG SRC="images/img2.jpg" WIDTH=159 HEIGHT=81 ALT=""></TD>
    </TR>
    <TR>
        <TD COLSPAN=6>
            <IMG SRC="images/img3.jpg" WIDTH=159 HEIGHT=79 ALT=""></TD>
    </TR>
    <TR>
          <TD COLSPAN=6> <IMG SRC="images/but1.jpg" ALT="" WIDTH=159 HEIGHT=42 border="0" usemap="#Map"></TD>
    </TR>
</TABLE>      </TD>
        <TD width="12%"> 
<TABLE WIDTH=167 BORDER=0 CELLPADDING=0 CELLSPACING=0>
    <TR>
        <TD COLSPAN=2>
            <IMG SRC="images/h2.jpg" WIDTH=167 HEIGHT=25 ALT=""></TD>
    </TR>
    <TR>
        <TD COLSPAN=2 background="images/bg1.gif" HEIGHT=94>
<div style="padding:20;padding-top:5;padding-right:10;padding-bottom:0;color:ffffff" class="tah10">
<strong>Noesis</strong><br><br>
 <strong>Inovative EHR Services </strong> <br>
 <br>
</div>      </TD>
    </TR>
    <TR>
        <TD COLSPAN=2>
            <IMG SRC="images/s4.jpg" WIDTH=167 HEIGHT=52 ALT=""></TD>
    </TR>
    <TR>
        <TD COLSPAN=2 background="images/bg2.gif">
<div style="padding-left:0px;padding-top:12px;padding-bottom:2"><a href="AddPatient.jsp"><span style="padding-left:20;padding-top:5">Add Patient </span></a></div>      </TD>
    </TR>
    <TR>
        <TD COLSPAN=2 background="images/bg3.gif" HEIGHT=18>
<div style="padding-left:20;padding-top:5"><a href="AddPastMedicalHistory.jsp">Add Patient History</a> </div>       

    </TR>
    <TR>
        <TD COLSPAN=2 background="images/bg4.gif" HEIGHT=18>
<div style="padding-left:20;padding-top:5"><a href="AddPatientInsurance.jsp">Add Patient Insurance</a></div>        </TD>
    </TR>
    <TR>
        <TD COLSPAN=2 background="images/bg5.gif" HEIGHT=18 >
<div style="padding-left:20;padding-top:5">View Patient Records</div></TD>
    </TR>
    <TR>
        <TD COLSPAN=2 background="images/bg6.gif" HEIGHT=18 >
<div style="padding-left:20;padding-top:5"><a href="#"></a><a href="AboutUs.jsp">About  Us</a></div>        </TD>
    </TR>
    <TR>
        <TD COLSPAN=2 background="images/bg7.gif" HEIGHT=18 >
<div style="padding-left:20;padding-top:5"><a href="#"></a><a href="ContactUs.jsp">Contact Us</a></div>     </TD>
    </TR>
    <TR>
        <TD COLSPAN=2 background="images/bg8.gif" HEIGHT=18 >
<div style="padding-left:20;padding-top:5"><a href="#"></a></div>       </TD>
    </TR>
    <TR>
        <TD COLSPAN=2>
            <IMG SRC="images/h3.gif" WIDTH=167 HEIGHT=65 ALT=""></TD>
    </TR>
    <TR>
        <TD COLSPAN=2 background="images/bg9.gif" HEIGHT=94>
<div style="padding:15;padding-top:3;padding-bottom:3;color:737373" class="tah10"></div>        </TD>
    </TR>
    <TR>
        <TD COLSPAN=2>
            <IMG SRC="images/h4.jpg" WIDTH=167 HEIGHT=41 ALT=""></TD>
    </TR>
    <TR>
        <TD background="images/bg10.jpg" WIDTH=123 HEIGHT=32>
          <div style="padding-left:15;padding-top:1">
            <input name="text" type="text" size="11">
          </div></TD>
          <TD width="44"> <IMG SRC="images/but2.jpg" ALT="" WIDTH=44 HEIGHT=32 border="0" usemap="#Map2"></TD>
    </TR>
    <TR>
        <TD COLSPAN=2>
            <IMG SRC="images/s5.jpg" WIDTH=167 HEIGHT=48 ALT=""></TD>
    </TR>
    <TR>
      <TD COLSPAN=2>&nbsp;</TD>
      </TR>
</TABLE>      </TD>
      <TD width="72%"> 
          <table width=100% height="193" border=0 cellpadding=0 cellspacing=0>
          <tr>
            <td height=172 colspan="4" ><span class="bgtop"><img src="images/f_m.jpg"></span></td>
            <td height=172 colspan="2" width="63%" background="images/bg_tile_1.gif" class="bgtop">&nbsp;</td>
          </tr>

          <tr>
            <td height=19 colspan="4" background="images/bg11.gif" >&nbsp;</td>
          </tr>
        </table>
        <%! private ResultSet rsResult; %>

         <%!   cDBProcessor DBProcess = new cDBProcessor(); %>



        <%
            DBProcess.ConnectTODB();
            if(request.getAttribute("dbrec") != null)
            {
                rsResult = DBProcess.statement.executeQuery("SELECT * FROM patients");
            }//end if
            out.println("<table border=\"0\"><tr><td valign=\"top\" >");
            out.println("<tr><th>Patient ID</th><th>First Name</th><th>Middle Name</th><th>Last Name</th><th>Gender</th><th>Marital Status</th><th>Phone No.</th><th>Address</th>");
            out.println("<th>Date Of Birth</th><th>Last Date Of Exam</th><th>Status</th></tr>");

            //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("<tr><td>"+bdPatientID+"</td><td>"+strFirstname+"</td><td>"+strMiddlename+"</td><td>"+strLastname+"</td>");
                       out.println("<td>"+strGeneder+"</td><td>"+strMeritalStatus+"</td><td>"+bdPhoneNo+"</td><td>"+strAddress+"</td>");
                       out.println("<td>"+strDOB+"</td><td>"+strDOE+"</td><td>"+strStatus+"</td></tr>");

                    }//end while
                    out.println("</table>");
                }//end try
                catch (SQLException ex)
                {
                    out.println("<I>exception</I><br>");

                }//end catch
            }//end if

        DBProcess.CloseDB();
        %>

      </TD>
        <TD width="4%" background="images/bg_tile_1.gif" class="bgtop">&nbsp;</TD>
    </TR>
    <TR>
        <TD height="100%" colspan="4">&nbsp;</TD>
    </TR>
    <TR>
        <TD colspan="3">
<TABLE WIDTH=768 BORDER=0 CELLPADDING=0 CELLSPACING=0>
    <TR>
        <TD width="326">
            <IMG SRC="images/s7.gif" WIDTH=326 HEIGHT=48 ALT=""></TD>
        <TD background="images/bg16.gif" WIDTH=442 HEIGHT=48>
<div style="padding-top:12;color:A8A8A8" class="tah11">
2010 © Copyright iAS. <Br>
All rights Reserved. Read <a href="#" style="color:467B99" class="tah11">Privacy Policy</a>.</div>      </TD>
    </TR>
</TABLE>        </TD>
        <TD width="4%" background="images/bg_tile_2.gif">&nbsp;</TD>
    </TR>
</TABLE>
<!-- End ImageReady Slices -->
<map name="Map">
  <area shape="rect" coords="39,2,133,27" href="#">
</map>
<map name="Map2">
  <area shape="circle" coords="9,12,9" href="#">
</map>
</BODY>
</HTML> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:57:58+00:00Added an answer on May 16, 2026 at 8:57 pm

    beside those issues pointed out by BalusC,

    base on the described symptom “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” and code “if(request.getAttribute(“dbrec”) != null) “.

    My prime suspect for the issue’s cause is the use of request.getAttribute(“dbrec”)

    for those direct access from other html page, this value likely to be null. I suspect for redirect case, there may be some code that perform request.setAttribute(“dbrec”,….)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.