I am just trying to run my
jsp page.... it hits and database.. nothing special...
Here is my code....
<%@ page language="java" contentType="text/html" %>
<%@ page import="java.sql.*" %>
<%@ page import="forum.DataAccess" %>
<%@ page import="forum.areaformat" %>
<%
// Request the information from the url
String catid = request.getParameter("catid");
String threadid = request.getParameter("threadid");
// Create a new istance of the areaformat class
areaformat a = new areaformat();
// Create a new instance of the DataAccess Class
DataAccess d = new DataAccess("/home/richardb/webroot/WEB-INF/classes/forum/");
// This call the database connection method from the DataAccess Class
d.ConnectDatabase();
/* This gets the threads messages from database */
// This is initilzing the variables
String threadname = "";
String threadmessage = "";
String threaddate = "";
String threadhandle = "";
String threadrole = "";
String replyhandle = "";
String replyrole = "";
String replymessage = "";
String replydate = "";
int readonly = 0;
// This sets the sql variable to nothing
String sql = "";
// This sets the rs variable to null
ResultSet rs = null;
// This is doing a SELECT on the
thread table based on the category id
sql += "select c.fc_readonly, p.fp_handle, p.fp_role, t.ft_threadmessage, t.ft_profileid, t.ft_threaddate, t.ft_threadname from forum_threads t, forum_profile p, forum_categories c where c.fc_catid = t.ft_catid and t.ft_profileid = p.fp_profileid and ft_catid = '" + catid + "' and ft_threadid = '" + threadid + "'";
//sql += "select * from forum_threads";
rs = d.SQLQuery(sql);
/* End of thread messages */
while (rs.next()){
readonly = rs.getInt("fc_readonly");
threadhandle = rs.getString("fp_handle");
threadrole = rs.getString("fp_role");
threadmessage = rs.getString("ft_threadmessage");
threaddate = rs.getString("ft_threaddate");
threadname = rs.getString("ft_threadname");
}
rs.close();
// This gets the current url
String url1 = "";
String servername1 = request.getServerName();
int serverport1 = request.getServerPort();
String uri1= request.getRequestURI();
String query = request.getQueryString();
url1 += "http://";
url1 += servername1;
url1 += ":";
url1 += serverport1;
url1 += uri1;
url1 += "?";
url1 += query;
%>
<html>
<head>
<title>Geomatics Canada Forums</title>
<!--- This calls the style sheet --->
<%@ include file="template/style.css" %>
</head>
<body>
<table cellpadding="0" cellspacing="1" border="0" width="700" align="center">
<tr>
<td>
<!--- This calls the forum logo --->
<%@ include file="template/forum_logo.jsp" %>
</td>
<td valign="bottom" align="right">
<!--- This calls the forum logo --->
<%@ include file="template/header_view.jsp" %>
</td>
</tr>
<tr>
<td colspan="2">
<table cellpadding="0" cellspacing="1" border="0" width="700">
<tr>
<td class="tablefunctions" width="100" height="40">
Author
</td>
<td class="tablefunctions" width="600">
<font class="smalltext">Thread Message for:</font> <i><%= threadname %></i>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table cellpadding="2" cellspacing="1" border="0" width="700">
<tr>
<td class="tablerows" width="100" align="center" valign="top">
<br>
<%= threadhandle %>
<br><br>
<%= threadrole %>
<br><br>
</td>
<td class="tablerows" width="600" valign="top">
<font class="smalltext"><%= threaddate %></font>
<br><br>
<%= a.replace(threadmessage, '\n', "<BR>") %>
<% if (readonly == 0){ %><font class="smalltext"><a href="forum_messagepost.jsp?catid=<%= catid %>&threadid=<%= threadid %>">Reply</a></font><% } %>
</td>
</tr>
<%
sql = "select p.fp_handle, p.fp_role, m.fm_messagetext, m.fm_messagedate from forum_messages m, forum_profile p where p.fp_profileid = m.fm_profileid and fm_catid = '" + catid + "' and fm_threadid = '" + threadid + "' order by fm_messagedate asc ";
rs = d.SQLQuery(sql);
while (rs.next())
{
replyhandle = rs.getString("fp_handle");
replyrole = rs.getString("fp_role");
replymessage = rs.getString("fm_messagetext");
replydate = rs.getString("fm_messagedate");
%>
<tr>
<td class="tablerows" width="100" align="center" valign="top">
<br>
<%= replyhandle %>
<br><br>
<%= replyrole %>
<br><br>
</td>
<td class="tablerows" width="600" valign="top">
<font class="smalltext"><%= replydate %></font>
<br><br>
<%= a.replace(replymessage, '\n', "<BR>") %>
<br><br>
<font class="smalltext"><a href="forum_messagepost.jsp?catid=<%= catid %>&threadid=<%= threadid %>">Reply</a></font>
</td>
</tr>
<%
}
rs.close();
%>
</table>
</td>
</tr>
</table>
</body>
</html>