//
// Filename: Default.jsp
// Generated with CodeCharge v.1.2.0
// JSP.ccp build 05/21/01
//
static final String sFileName = "Default.jsp";
static final String PageBODY = "bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#0000FF\" vlink=\"#800080\" alink=\"#FF0000\"";
static final String FormTABLE = "border=\"0\" cellspacing=\"0\" cellpadding=\"2\"";
static final String FormHeaderTD = "align=\"center\" bgcolor=\"#99CCFF\"";
static final String FormHeaderFONT = "style=\"font-size: 12pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica; font-weight: bold\"";
static final String FieldCaptionTD = "bgcolor=\"#FFFF99\"";
static final String FieldCaptionFONT = "style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\"";
static final String DataTD = "bgcolor=\"#F5F5F5\"";
static final String DataFONT = "style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\"";
static final String ColumnFONT = "style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica; font-weight: bold\"";
static final String ColumnTD = "bgcolor=\"#FFD9E5\"";
%>
boolean bDebug = false;
String sAction = getParam( request, "FormAction");
String sForm = getParam( request, "FormName");
String sSearchErr = "";
String sCategoriesErr = "";
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) {}
}
if ( sForm.equals("Categories") ) {
sCategoriesErr = CategoriesAction(request, response, session, out, sAction, sForm, conn, stat);
if ( "sendRedirect".equals(sCategoriesErr)) return;
}
%>
YellowPages
This dynamic site was generated with CodeCharge
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 fldname="";
String fldaddress="";
String fldcity="";
String fldstate="";
String fldzip="";
String sSQL="";
String transitParams = "";
String sQueryString = "";
String sPage = "";
out.println(" ");
out.println(" \n Search\n ");
out.println(" \n ");
// Set variables with search parameters
fldname = getParam( request, "name");
fldaddress = getParam( request, "address");
fldcity = getParam( request, "city");
fldstate = getParam( request, "state");
fldzip = getParam( request, "zip");
// Show fields
out.println(" Name");
out.print(" "); out.print("");
out.println("\n \n ");
out.println(" Address");
out.print(" "); out.print("");
out.println("\n \n ");
out.println(" City");
out.print(" "); out.print("");
out.println("\n \n ");
out.println(" State");
out.print(" "); out.print("");
out.println("\n \n ");
out.println(" ZIP");
out.print(" "); out.print("");
out.println("\n \n ");
out.println(" ");
out.println(" \n \n ");
out.println("");
}
catch (Exception e) { out.println(e.toString()); }
}
String sActionFileName = "Default.jsp";
String CategoriesAction(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpSession session, javax.servlet.jsp.JspWriter out, String sAction, String sForm, java.sql.Connection conn, java.sql.Statement stat) throws java.io.IOException {
try {
String sCatId = getParam( request, "category_id");
String sOp = "=";
if ( isEmpty(sCatId) || ! isNumber(sCatId) ) {
sCatId = "null";
sOp = " is ";
}
long lNRec = dCountRec( stat, "categories", "par_category_id"+ sOp + sCatId);
if ( lNRec == 0 ) {
try {
if ( stat != null ) stat.close();
if ( conn != null ) conn.close();
}
catch ( java.sql.SQLException ignore ) {}
response.sendRedirect("Entries.jsp?category_id=" + sCatId);
return "sendRedirect";
}
}
catch (Exception e) { out.println(e.toString()); };
return ("");
}
void Categories_Show(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpSession session, javax.servlet.jsp.JspWriter out, String sCategoriesErr, String sForm, String sAction, java.sql.Connection conn, java.sql.Statement stat) throws java.io.IOException {
try {
String transitParams = "";
String sQueryString = "";
String sPage = "";
String sSQL = "select category_id, name, par_category_id from categories";
String sCatID = getParam( request, "category_id");
String sWhere = "";
java.sql.ResultSet rs = null;
String sCatPath = "";
String sCatList = "";
String sParCatID = "";
String sCatName = "";
String sPath = "";
String stCatID = "";
String stParCatID = "";
String stCatName = "";
out.println(" ");
out.println(" \n Top");
if (sCatID == null || sCatID.compareTo("") == 0 || ! isNumber(sCatID)) {
// Root category
sWhere = " where par_category_id is Null";
}
else {
// Subcategory
sWhere = " where category_id=" + sCatID;
rs = openrs ( stat, sSQL + sWhere);
if ( rs.next()) {
java.util.Hashtable rsHash = new java.util.Hashtable();
String[] aFields = getFieldsName( rs );
getRecordToHash( rs, rsHash, aFields );
sCatPath = "";
sCatList = "";
sParCatID = toHTML((String) rsHash.get("par_category_id"));
sCatName = toHTML((String) rsHash.get("name"));
}
rs.close();
sPath = " > "+sCatName+"\n ";
// Build Path
stParCatID = sParCatID;
while ( stParCatID.compareTo("") != 0 ) {
rs = openrs ( stat, sSQL + " where category_id=" + stParCatID);
java.util.Hashtable rsHash = new java.util.Hashtable();
String[] aFields = getFieldsName( rs );
if ( rs.next() ) {
getRecordToHash( rs, rsHash, aFields );
stCatID = toHTML((String) rsHash.get("category_id"));
stParCatID = toHTML((String) rsHash.get("par_category_id"));
stCatName = toHTML((String) rsHash.get("name"));
sPath = "> "+stCatName+"" + sPath;
}
rs.close();
}
out.println(sPath);
sWhere = " where par_category_id=" + sCatID;
}
// Categories list
rs = openrs ( stat, sSQL + sWhere);
if (rs != null) {
java.util.Hashtable rsHash = new java.util.Hashtable();
String[] aFields = getFieldsName( rs );
while ( rs.next() ) {
// Print subcategories
getRecordToHash( rs, rsHash, aFields );
stCatID = toHTML((String) rsHash.get("category_id"));
stParCatID = toHTML((String) rsHash.get("par_category_id"));
stCatName = toHTML((String) rsHash.get("name"));
out.println(" \n "+stCatName+"\n ");
}
}
rs.close();
out.println(" ");
}
catch (Exception e) { out.println(e.toString()); };
}
%>