I've the below JSP
<table>
<thead>
<th>Patient ID</th>
<th>Name</th>
<th>Address</th>
<th>Contact No</th>
<th>Disease</th>
<th>Doctor Assigned</th>
<th>Date</th>
<th>Room Assigned</th>
</thead>
<%
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()) {
%>
<tr>
<td>
<%
out.print(rs.getInt(1));
%>
</td>
<td>Hi</td>
</tr>
<%
}
%>
</table>
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>
.