Need to use contents of current row from mysql table to print using jsp
<p>table.jsp: </p>

<pre><code>&lt;%
//jsp prog for database connection

String query="SELECT total,gtotal from allinvoice";
statement=conn.createStatement();
resultset=statement.executeQuery(query);

if(resultset.next()){ %&gt;
&lt;br&gt;&lt;br&gt;
&lt;table class="center" cellpadding="7" border="1" style="background-color:  #F0F0FC;" &gt;
&lt;tr&gt;&lt;th align="left" &gt;Total&lt;/th&gt;&lt;th&gt;&lt;%= resultset.getDouble(1) %&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;%long i=resultset.getInt(15); %&gt;
&lt;tr&gt;&lt;th colspan="2"&gt;Grand Total&lt;/th&gt;&lt;th&gt;&lt;%= resultset.getInt(2) %&gt;&lt;/th&gt;    &lt;/tr&gt;
</code></pre>

<p>`
I have created a table with few columns which looks like this:</p>

<p><a href="https://i.stack.imgur.com/APj4f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/APj4f.png" alt="enter image description here"></a></p>

<p>Now when generate button is clicked jsp should print data of its respective row. I am using if() to print result set, but every i click generate it is printing only first row.the relevant code is table.jsp .please help.
thanks in advance</p>