【JSP开源代码栏目提醒】:网学会员为需要JSP开源代码的朋友们搜集整理了searches.jsp相关资料,希望对各位网友有所帮助!
<%@ page contentType="text/html;charset=gb2312"%>
<%@ include file="Common.jsp" %><%!
//
// Filename: searches.jsp
static final String sFileName = "searches.jsp";
static final String PageBODY = "link=\"#000000\" vlink=\"#0033cc\" alink=\"red\"";
static final String FormTABLE = "border=\"0\" cellspacing=\"1\" cellpadding=\"3\"";
static final String FormHeaderTD = "bgcolor=\"#c2c2c2\"";
static final String FormHeaderFONT = "face=\"arial\" style=\"font:bold\" color=\"#0033cc\"";
static final String FieldCaptionTD = "bgcolor=\"#f2f2f2\"";
static final String FieldCaptionFONT = "face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\"";
static final String DataTD = "";
static final String DataFONT = "face=\"arial\" size=\"2\"";
static final String ColumnFONT = "face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\"";
static final String ColumnTD = "bgcolor=\"#f2f2f2\"";
%><%
boolean bDebug = false;
String sAction = getParam( request, "FormAction");
String sForm = getParam( request, "FormName");
String sSearchErr = "";
String sMessagesErr = "";
java.sql.Connection conn = null;
java.sql.Statement stat = null;
String sErr = loadDriver();
conn = cn();
stat = conn.createStatement();
if ( ! sErr.equals("") ) {
try {
out.println(sErr);
}
catch (Exception e) {}
}
%>
<html>
<head>
<title>SearchRes</title>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body link="#000000" vlink="#0033cc" alink="red">
<jsp:include page="header.jsp" flush="true"/>
<table>
<tr>
<td valign="top">
<% Search_Show(request, response, session, out, sSearchErr, sForm, sAction, conn, stat); %>
</td>
</tr>
</table>
<table>
<tr>
<td valign="top">
<% Messages_Show(request, response, session, out, sMessagesErr, sForm, sAction, conn, stat); %>
</td>
</tr>
</table>
</body>
</html>
<%%>
<%
if ( stat != null ) stat.close();
if ( conn != null ) conn.close();
%>
<%!
void Search_Show (javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpSession session, javax.servlet.jsp.JspWriter out, String sSearchErr, String sForm, String sAction, java.sql.Connection conn, java.sql.Statement stat) throws java.io.IOException {
try {
String flds_topic="";
String sSQL="";
String transitParams = "";
String sQueryString = "";
String sPage = "";
out.println(" <table border=\"0\" cellspacing=\"1\" cellpadding=\"3\">");
out.println(" <form method=\"get\" action=\"searches.jsp\" name=\"Search\">\n <tr>");
// Set variables with search parameters
flds_topic = getParam( request, "s_topic");
// Show fields
out.println(" <td bgcolor=\"#f2f2f2\"><font face=\"arial\" size=\"2\" style=\"font:bold\" color=\"#0033cc\"></font></td>");
out.print(" <td >"); out.print("<input type=\"text\" name=\"s_topic\" maxlength=\"50\" value=\""+to
HTML(flds_topic)+"\" size=\"\">");
out.println("</td>");
out.println(" <td ><input type=\"submit\" value=\"Search\"/></td>");
out.println(" </tr>\n </form>\n </table>");
out.println("");
}
catch (Exception e) { out.println(e.toString()); }
}
void Messages_Show (javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpSession session, javax.servlet.jsp.JspWriter out, String sMessagesErr, 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 ps_topic="";
formParams = "s_topic=" + toURL(getParam( request, "s_topic")) + "&";
// Build WHERE statement
// Check Messages parameter and create a valid sql for where clause
ps_topic = getParam( request, "s_topic");
if ( ! ps_topic.equals("") ) {
hasParam = true;
sWhere = "m.message like '%" + replace(ps_topic, "'", "''") + "%'" + " or " + "m.topic like '%" + replace(ps_topic, "'", "''") + "%'";}
if (hasParam) { sWhere = " WHERE (" + sWhere + ")"; }
// Build ORDER statement
String sSort = getParam( request, "FormMessages_Sorting");
String sSorted