<table width= "80%" border= "1" align= "Center" >
<%
Calc Calc = new Calc (); New A Calc Class
int n = 0; Mark a column tag
for (int i = 1; i <=; i++) {//number within loop 1000
Calc.setvalue (i); Assigns a value within 1000 to the value in the Calc class
if (Calc.isprime ()) {//calls the IsPrime method in the Calc class, this method is used to determine whether a prime number
n++; //
if (n% 5 = = 1) {//use modulo to calculate if each column has a value
Out.print ("<tr>"); Typing a column label with HTML tags
}
%>
<td><%=i%></td><!--Output Value-->>
<%
if (n% 5 = = 0) {//use modulo to calculate if each column has a value
Out.print ("</tr>"); Typing a column label with HTML tags
}
}
}
if (n% 5 = = 1) {//use modulo to calculate if each column has a value
Out.print ("<td></td><td></td><td></td><td></td></tr>"); If only one value hits 4 blank cells
} else if (n 5 = = 2) {//use modulo to calculate if each column has a value
Out.print ("<td></td><td></td><td></td></tr>"); If only two values hit 3 blank cells
} else if (n 5 = = 3) {//use modulo to calculate if each column has a value
Out.print ("<td></td><td></td></tr>"); If only three values hit 2 blank cells
} else if (n 5 = = 4) {//use modulo to calculate if each column has a value
Out.print ("<td></td></tr>"); If only four values hit 1 blank cells
} else if (n 5 = = 5) {//use modulo to calculate if each column has a value
Out.print ("</tr>"); If only no value hit the direct End column label
}
%>
</table>
Use JSP to print all prime numbers within 1000 of a table on a browser