?? viewthread.jsp
字號:
}
if (iCounter == 0) {
// Recordset is empty
out.println(sNoRecords);
out.print(" <tr>\n <td colspan=\"4\" bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">");
out.print("<a href=\"reply.jsp?"+formParams+"\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\"><img border=\"0\" src=\"images/reply.gif\"></font></a> ");
out.println("</td>\n </tr>");
iCounter = RecordsPerPage+1;
bIsScroll = false;
}
else {
// Parse scroller
boolean bInsert = false;
boolean bNext = rs.next();
if ( !bNext && iPage == 1 ) {
out.print(" <tr>\n <td colspan=\"2\" bgcolor=\"#f2f2f2\">\n <font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">");
out.print("\n <a href=\"reply.jsp?"+formParams+"\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\"><img border=\"0\" src=\"images/reply.gif\"></font></a> ");
out.println("\n </td>\n </tr>");
}
else {
out.print(" <tr>\n <td colspan=\"2\" bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">");
out.print("\n <a href=\"reply.jsp?"+formParams+"\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\"><img border=\"0\" src=\"images/reply.gif\"></font></a> ");
bInsert = true;
if ( iPage == 1 ) {
out.print("\n <a href_=\"#\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Previous</font></a>");
}
else {
out.print("\n <a href=\""+sFileName+"?"+formParams+sSortParams+"Formmessage_Page="+(iPage - 1)+"#Form\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Previous</font></a>");
}
out.print("\n [ "+iPage+" ]");
if (!bNext) {
out.print("\n <a href_=\"#\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Next</font></a><br>");
}
else {
out.print("\n <a href=\""+sFileName+"?"+formParams+sSortParams+"Formmessage_Page="+(iPage + 1)+"#Form\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Next</font></a><br>");
}
if ( ! bInsert ) {
out.print(" <tr>\n <td colspan=\"4\" bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">");
out.print("\n <a href=\"reply.jsp?"+formParams+"\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\"><img border=\"0\" src=\"images/reply.gif\"></font></a> ");
}
out.println("</td>\n </tr>");
}
}
if ( rs != null ) rs.close();
out.println(" </table>");
}
catch (Exception e) { out.println(e.toString()); }
}
void replies_Show (javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpSession session, javax.servlet.jsp.JspWriter out, String srepliesErr, String sForm, String sAction, java.sql.Connection conn, java.sql.Statement stat) throws java.io.IOException {
String sWhere = "";
int iCounter=0;
int iPage = 0;
boolean bIsScroll = true;
boolean hasParam = false;
String sOrder = "";
String sSQL="";
String transitParams = "";
String sQueryString = "";
String sPage = "";
int RecordsPerPage = 20;
String sSortParams = "";
String formParams = "";
String pmid="";
formParams = "mid=" + toURL(getParam( request, "mid")) + "&";
// Build WHERE statement
//-- Check mid parameter and create a valid sql for where clause
pmid = getParam( request, "mid");
if ( ! isNumber (pmid)) {
pmid = "";
}
if (pmid != null && ! pmid.equals("")) {
hasParam = true;
sWhere += "m.message_parent_id=" + pmid;
}
if (hasParam) { sWhere = " WHERE (" + sWhere + ")"; }
// Build ORDER statement
sOrder = " order by m.date_entered Desc";
// Build full SQL statement
sSQL = "select m.author as m_author, " +
"m.date_entered as m_date_entered, " +
"m.message as m_message, " +
"m.message_parent_id as m_message_parent_id, " +
"m.topic as m_topic " +
" from messages m ";
sSQL = sSQL + sWhere + sOrder;
String sNoRecords = " <tr>\n <td colspan=\"2\" ><font face=\"arial\" size=\"2\">No records</font></td>\n </tr>";
String tableHeader = "";
try {
out.println(" <table border=\"0\" cellspacing=\"1\" cellpadding=\"3\">");
out.println(" <tr>\n <td bgcolor=\"#c2c2c2\" colspan=\"2\"><a name=\"replies\"><font face=\"arial\" style=\"font:bold\" color=\"#0033cc\">Responses</font></a></td>\n </tr>");
out.println(tableHeader);
}
catch (Exception e) {}
try {
// Select current page
iPage = Integer.parseInt(getParam( request, "Formreplies_Page"));
}
catch (NumberFormatException e ) {
iPage = 0;
}
if (iPage == 0) { iPage = 1; }
RecordsPerPage = 20;
try {
java.sql.ResultSet rs = null;
// Open recordset
rs = openrs( stat, sSQL);
iCounter = 0;
absolute (rs, (iPage-1)*RecordsPerPage+1);
java.util.Hashtable rsHash = new java.util.Hashtable();
String[] aFields = getFieldsName( rs );
// Show main table based on recordset
while ( (iCounter < RecordsPerPage) && rs.next() ) {
getRecordToHash( rs, rsHash, aFields );
String fldauthor = (String) rsHash.get("m_author");
String flddate_entered = (String) rsHash.get("m_date_entered");
String fldmessage = (String) rsHash.get("m_message");
String fldtopic = (String) rsHash.get("m_topic");
fldmessage = replace(fldmessage,CRLF,"<br>");
out.print(" <tr>\n <td bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Topic</font> </td><td >"); out.print("<font face=\"arial\" size=\"2\">"+toHTML(fldtopic)+" </font>");
out.println("</td>\n </tr>");
out.print(" <tr>\n <td bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Author</font> </td><td >"); out.print("<font face=\"arial\" size=\"2\">"+toHTML(fldauthor)+" </font>");
out.println("</td>\n </tr>");
out.print(" <tr>\n <td bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Date Created</font> </td><td >"); out.print("<font face=\"arial\" size=\"2\">"+toHTML(flddate_entered)+" </font>");
out.println("</td>\n </tr>");
out.print(" <tr>\n <td bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Message</font> </td><td >"); out.print("<font face=\"arial\" size=\"2\">"+fldmessage+" </font>");
out.println("</td>\n </tr>");
out.println(" <tr>\n <td colspan=\"2\" > </td>\n </tr>");
iCounter++;
}
if (iCounter == 0) {
// Recordset is empty
out.println(sNoRecords);
iCounter = RecordsPerPage+1;
bIsScroll = false;
}
else {
// Parse scroller
boolean bInsert = false;
boolean bNext = rs.next();
if ( !bNext && iPage == 1 ) {
}
else {
out.print(" <tr>\n <td colspan=\"2\" bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">");
if ( iPage == 1 ) {
out.print("\n <a href_=\"#\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Previous</font></a>");
}
else {
out.print("\n <a href=\""+sFileName+"?"+formParams+sSortParams+"Formreplies_Page="+(iPage - 1)+"#Form\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Previous</font></a>");
}
out.print("\n [ "+iPage+" ]");
if (!bNext) {
out.print("\n <a href_=\"#\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Next</font></a><br>");
}
else {
out.print("\n <a href=\""+sFileName+"?"+formParams+sSortParams+"Formreplies_Page="+(iPage + 1)+"#Form\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\">Next</font></a><br>");
}
out.println("</td>\n </tr>");
}
}
if ( rs != null ) rs.close();
out.println(" </table>");
}
catch (Exception e) { out.println(e.toString()); }
}
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -