Hi all, I'm very2 new to JSP, I've give a task to make a search and pagination function for my project.... but look like it to tough for me.... here is my code... can anyone help me??
<%--
Document : index
Created on : Jul 21, 2010, 11:40:54 AM
Author : Administrator
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page language ="java" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>REPORT PAGE</title>
<link href="styles.css" rel="stylesheet" type="text/css">
<link href="tablesort.css" rel="stylesheet" type="text/css">
<script src ="tablesort.js" language="JavaScript" type="text/JavaScript"></script>
<style type="text/css">
#bottom {
width: 98.5%;
position: fixed;
bottom: 0px;
background: #FFFFFF;
text-align: center;
}
</style>
<div id="bottom"> <b>Web Development By Amirrullah Abd Rahman © TMRnD 2010</b></div>
</head>
<script language="JavaScript" type="text/JavaScript">
Stamp = new Date();
year = Stamp.getYear();
if (year < 2000) year = 1900 + year;
document.write('<center><font size="5" face="Arial"><B>' + Stamp.getDate() +"/"+(Stamp.getMonth() + 1)+ "/"+ year + '</B></font><BR></center>');
var Hours;
var Mins;
var Time;
Hours = Stamp.getHours();
if (Hours >= 12) {
Time = " PM";
}
else {
Time = " AM";
}
if (Hours > 12) {
Hours -= 12;
}
if (Hours == 0) {
Hours = 12;
}
Mins = Stamp.getMinutes();
if (Mins < 10) {
Mins = "0" + Mins;
}
document.write('<center><font size="5" face="Arial"><B>' + Hours + ":" + Mins + Time + '</B></font></center>');
</script>
<%
Connection con = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@10.44.37.10:1521:FRAT","","");
Statement s=con.createStatement();
ResultSet rs = s.executeQuery("Select * from report where cost > 20 order by service_name ");
%>
<table cellspacing="1" cellpadding="1" border="0" class="tdTable">
<thead>
<tr class="tdHead">
<td>SERVICE_NAME</td>
<td>DURATION </td>
<td>REVENUE </td>
<td>COST_PER_MIN</td>
<td>COST </td>
<td>EGRESS_IP_ADDR</td>
<td>SEIZE_DATETIME</td>
<td>CALL_IND_SERVICE_NAME_ID</td>
<td>DEST_AREA_CODE </td>
<td>COUNTRY_NAME </td>
<td>SERIAL_NUMBER </td>
<td>CALLING_SUB_NUMBER</td>
<td>ROUTE</td>
</thead>
<tbody>
<%
while (rs.next())
{%>
<tr class="tdRow">
<td><%=rs.getString("SERVICE_NAME")%></td>
<td><%=rs.getString("DURATION")%></td>
<td><%=rs.getString("REVENUE")%></td>
<td><%=rs.getFloat("COST_PER_MINUTE")%></td>
<td><%=rs.getFloat("COST")%></td>
<td><%=rs.getString("EGRESS_IP_ADDR")%></td>
<td><%=rs.getString("SEIZE_DATETIME")%></td>
<td><%=rs.getString("CALL_IND_SERVICE_NAME_ID")%></td>
<td><%=rs.getString("DEST_AREA_CODE")%></td>
<td><%=rs.getString("COUNtrY_NAME")%></td>
<td><%=rs.getString("SERIAL_NUMBER")%></td>
<td><%=rs.getString("CALLING_SUB_NUMBER")%></td>
<td><%=rs.getString("ROUTE")%></td>
</tr>
<%}
rs.close();
s.close();
%>
</tbody>
</table>
<%
}
catch (SQLException e) {
e.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
finally {
con.close();
}
%>
</body>
</html>
sorry my code a bit messy... hope some kind soul will help me =)