I have the following java code:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class License {
public static void main(String[] args) {
Connection connection = null;
ResultSet resultSet = null;
Statement statement = null;
try {
Class.forName("org.sqlite.JDBC");
connection = DriverManager.getConnection("jdbc:sqlite:C:/license_tracker/usage.db3");
statement = connection.createStatement();
System.out.println("Connection Successful!!!!");
String query = "SELECT USR.id,USR.name, ST.license FROM users USR, status ST, upd_ate UD WHERE UD.upt_id = (select max(p2.upt_id) from upd_ate p2) AND ST.id = USR.id AND ST.upt_id = UD.upt_id ORDER BY ST.license,USR.name";
resultSet = statement.executeQuery(query);
while (resultSet.next()) {
System.out.printf("%8s %-50s %-7s%n",resultSet.getString("cymer_id"), resultSet.getString("name"), resultSet.getString("license"));
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
resultSet.close();
statement.close();
connection.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
I want to display the contents of the resultSet in a web browser, essentially IE9, in a tabular format. I've searched about this and I think there are two options to this, using JAVA applet or JSP. Since I have to run the code on the server should I use JSP?I'm not so familiar with JSP, so I would appreciate if someone can help me with that. I'm using Eclipse Indigo & have Tomcat ver 7.
I have a html code on the webpage layout. I wanna put the information in the table.
<!DOCTYPE html>
<html>
<head>
<!-- FORMAT OF THE BOXES //-->
<style type="text/css">
div.ex
{
width:360px;height:300px;
padding:10px;
border:5px solid gray;
margin:0px;
background-color:linen;}
div.graph
{
width:800px;height:300px;
padding:10px;
border:5px solid gray;
margin:0px;
background-color:linen;}
</style>
</head>
<body>
<!--h1=> LOGO & h2=> Heading //-->
<h2 style="text-align:center;font-family:century schoolbook;color:black";><b>Pro/Engineer And Intralink License Logs</b></h2>
<!-- License summary bar //-->
<div id="content" style="background-color:mediumpurple;clear:both;text-align:center;"><big>License Summary</big></div>
<!-- TABLES //-->
<center>
<table cellspacing="5" border="0" cellpadding="0">
<td><p><div class="ex"><center>DESIGNER LICENSES</center><br/></p></td>
<td width="2" bgcolor=black><BR></td>
<td>
<p><div class="ex"><center>LEAD LICENSES</center><br/></p>
</td>
<td width="2" bgcolor=black><BR></td>
<td>
<p><div class="ex"><center>CABLING LICENSES</center><br/></p>
</td>
<td width="2" bgcolor=black><BR></td>
<td>
<p><div class="ex"><center>LICENSES</center><br/></p>
</td>
</table>
</center>
<!-- GRAPH SPACE //-->
<p><div class="graph"><center>GRAPHICAL REPRESENTATION</center></div></p>
</body>
<hr/>
<center><style=padding:100px;>
<!-- FOOTER //-->
<footer>
<div id="donotremove">
<abbr title="License Availability (v1 on 32)">License Availability</abbr> © 2011-2351 All rights reserved.</a>.</div></footer>
</center>
</html>