unable to display jsp data in table

I’ve the below JSP

            <th>Patient ID</th>
            <th>Contact No</th>
            <th>Doctor Assigned</th>
            <th>Room Assigned</th>

            String Query = "Select ID, Name, address, contactnumber,disease,DOCASSIGN,JOINING, ROOMASSIGN from patient";
            PreparedStatement ps = conn.prepareStatement(Query);
            ResultSet rs = ps.executeQuery();
            while (rs.next()) {

I’m running the query and get the data into a table td. The query is running fine the problem is if i take <td><%out.print(rs.getInt(1));%></td>, then the value is displayed in td, but when i’m trying to get it using <td><%rs.getInt(1);%></td>, the td is showing blank.

I want to know if in jsp, to display value, we have to use out.print() for sure, or i can display the value directly using <td><%rs.getInt(1);%></td>


Source: jsp

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.