JSP message board source code (Oracle)

zhaozj2021-02-16  75

JSP message board source code 1: Give JSP beginners. Servers: precom (Pather) Oracle Datasheet creation.

Create Table Guestbook (LW_TITLE VARCHAR2 (100) Not Null Mailbox PK Expression Varchar2 (2) Not Null, - Expression LW_TIME VARCHAR2 (14) Not Null, - Published response time Answer_Num Number (3) Not null, - Numbers Click_Num Number (4) Not null, - Clicks Author_ip varcha2 (16), - Source IP LW_CLASS1 VARCHAR2 (10) Not Null, - Message Board PK LW_CLASS2 VARCHAR2 (20) Not Null, - Forum Column PK LW_TYPE VARCHAR2 (1) Not Null, - Message Category , That is, whether the main post

zt_time varchar2 (14), - the main paste time zt_author varchar2 (40), - the main paste email lw_content varchar2 (4000), - the content of constraint pk_guestbook primary key (lw_class1, lw_class2, lw _time, lw_author)) storage (initial 5M Next 5m Pctincrease 1);

Servers: precom (Pather) 2000.12.10

guestbook.jsp ====================================

Zhangjiajie Telephone Yellow Pages (Online 114) </ title> </ head> <style type = "text / css"> <! - body {font-family: "Song", "Arial Narrow", "Times New Roman "; font-si ze: 9pt} .p1 {font-family:" Song "," Arial Narrow "," Times New Roman "; Font-Siz E: 12pt} A: Link {color: # 00793d; Text Decoration: none} A: visited {text-decoration: none} A: Hover {text-decoration: underline} TD {font-family: "Song", "Arial Narrow", "Times New Roman"; Font-size: 9pt } .p2 {font-family: "Song", "Arial Narrow", "Times New Roman"; Font-Siz E: 9pt; line-height: 150%} .p3 {font-family: "Song", "Arial Narrow "," Times New Roman "; Font-Siz E: 9pt; line-height: 120%} -> </ stop></p> <p><body></p> <p><% @ Page ContentType = "TEXT / HTML; Charset = GB2312"%> <% @ page language = "java" import = "java.sql. *"%> <jsp: usebean id = "testinq" scope = "Page "Class =" ymbean.opdb "/> <% int pages = 1; int pot = 0; int Totalpages = 0;</p> <p>String countsql = "", inqsql = ", lwhere =" ", insertsql =" ", s =" ";</p> <p>String lw_title = "", lw_author = "", pagetitle = "", author_http = ", author_e mail =", lw_ico = ", lw_content =", lw_class1 = "; string author_ip =", lw_time = "", lw_class2 = ", zt_time =" "", zt _author = ""; int answer_num = 0, click_num = 0; int inquire_item = 1; string inquire_itemt = ", inquire_value ="; string LURLT = "<a href = guestbook.jsp?", llink = ""; lwhere = "where lw_type = 'z'"; // only display the primary post</p> <p>/ * Enumeration E = Request.getParameterNames (); while (E.hasMoreElements ()) {string name = (String) E.NEXTELEMENT (); * / try {// Take the displayed page page PageS = New Integer (Request " .GetParameter ("pages")). INTVALUE ();} catch (exception e) {} try {// Take the query parameter inquire_item = new integer ("Range")). IntValu E (); inquire_value = new String (request.getParameter ( "findstr") getByt es ( "ISO8859_1").); if (inquire_item == 0) inquire_itemt = "lw_title"; else if (inquire_item == 1) inquire_itemt = "lw_content"; else if (inquire_item == 2) inquire_itemt = "lw_author"; else if (inquire_item == 3) inquire_itemt = "lw_time"; else if (inquire_item == 4) inquire_itemt = "lw_title"; lwhere = lwhere "and" inquire_itemt "like '% " Inquire_Value "%' "; LURLT = LURLT " Range = " Inquire_Item " & FindStr = " Inquire_Value " & ";</p> <p>} catch (exception e) {}</p> <p>Try {// acquisition parameter message content LW_CLASS1 = New String (Request.getParameter ("gbname"). getBytes ("ISO885 9_1"); lw_title = new string (Request.getParameter ("lw_title"). getBytes ("ISO88 59_1 ")); lw_author = new string (" LW_AUTHOR "). GetBytes (" ISO 8859_1 "); pageTitle = new string (" pageTitle "). GetBytes (" ISO 8859_1 "); author_http = new String (request.getParameter ( "author_http") getBytes ( "ISO8859_1").); author_email = new String (request.getParameter ( "author_email") getByte s ( "ISO8859_1").); lw_ico = request.getParameter ( "gifface"); lw_content = new String (. request.getParameter ( "lw_content") getBytes ( "I SO8859_1")); String requestMethod = request.getMethod (); requestMethod = requestMethod.toUpperCase (); if (requestMethod. IndexOf ("post") <0) {OUT.PRINT ("illegal action!"); return;} // forms other data item author_ip = request.getRemoteAddr (); lw_time = testinq.getCurrentDate ("YYYYMMDDHHMMMSS"); lw_class2 = "2"; lw_type = "" "z"; // main post zt_time = LW_TIME; ZT_AUTHOR = LW_AUTHOR; answer_num = 0; click_num = 0; // ============== == ST = "','" ; // guarantee that the length of all data items is within the normal range IF (LW_TITLE.LENGTH ()> 50) LW_TITLE = LW_TITLE.SUBSTRING (0, 50); if (lw_author.length ()> 20) LW_AUTHOR = LW_AUTHOR.SUBSTRING (0, 20); if (author_http.length ()> 40) Author_http = author_http.substring (0,40);</p> <p>IF (Author_Email.Length ()> 50) Author_email = author_email.substring (0,40); if (lw_content.length ()> 4000) LW_CONTENT = LW_CONTENT.SUBSTRING (0,4000);</p> <p>insertsql = "insert into guestbook values ​​( '" lw_title st lw_author st author_http st author_email st lw_ico st lw_time "'," answer_num "," cli ck_num ", '" author_ip st lw_class1 st lw_class2 st lw_type st zt_time st zt_author st lw_content " ')"; //out.print(insertsql); // insert message try {String lmsg = testInq.executeUpdate (insertsql) ; if (LMSG.Indexof ("ExecuteUpdate OK") <0) Out.print ("LMSG =" LMSG);} catch (exception e) {Out.print ("Error: E);}} catch Exception E) {}%></p> <p><% // Verify the JavaScript string ljs = "<script language = javascript>" "<! " <" " {If (document.sign.lw_author.valument.sign.lw_author.value = = "" " " {Alert ("Please fill in your name."); " " Document.sign.LW_AUTHOR.FOCUS (); " " Return False;} " " f (Document.sign.LW_TITLE .Value == "" " " {Alert ("Please fill in the message topic."); " " Document.sign.LW_TITLE.FOCUS (); " " Return False;} " " f (Document.sign .author_email.value! = "" " " {IF ((Document.Sign.Author_Email.Value.Indexof ("@") <0) // (Document. Sign.Author_Email.Value.Indexof (":") ! = - 1)) " " {Alert ("The email you fill in is invalid, please fill in an effective email!"); " " Document.Sign.author_emaill.focus (); " " Return False; " "}" "}" "}" "}" "function validsearch ()" "{if (Document.frmsearch.FindStr.Value ==") " " {Alert ("You can't search Empty string! ");" "Document.frmsearch.FindStr.focus ();" "Return False;}" "}" "// ->" "</ script>"; out.print (ljs);%></p> <p><% // Message board interface head String LTOP = "<div align = center>" "<center>" "<form action = guestbook.jsp method = post name = frsearch>" "<input name = GBNAME TYPE = hidden value = cnzjj_gt> " " <table align = center border = 0 cellspacing = 1 width = "95%"> " " <tbody> " " <tr> " " <td bgcolor = # 336699 colspan = 2 width = "100%"> " " <p align = center> <font color = # ffffff Face = 体 _GB2312 " size = 5> Welcome distant friends to Zhangjiajie" </ font> </ p > </ Td> </ tr> " " <tr bgcolor = # 6699cc> " " <TD align = left nowrap width = "50%"> Home: <a " " href = "http: // www .zj.hn.cn "Target = _BLANK> <font" "color = # fffff> Zhangjiajie Travel </ font> </A> Administrator: <a" "href =" mailto: dzx@mail.zj. Hn.cninfo.net> <font</p> <p>Color = # ffffff> One people </ font> </a> " " >> <a "href="http://www.zj.hn.cn "> <font" "color = # ffffffff > Manage </ font> </a> >> <a " " href=" http://www.zj.hn.cn "> <font " " color = # funt> </ A> </ td> " " <TD align = Right Width = "50%"> <select class = oufont name = range s ze = 1> " " <option selected value = 0> Press topic </ option> <Option value = 1> Press the content </ option> <option value = 2> Press Author </ option> <option value = 3> Press the date </ OPTI ON> <option " " value = 4> Topic & Contents </ option> </ select> <input name = findst r> <input name = search οnclick = "Return Validsearch ()" TYPE = Submit Val UE = "Search"> " " </ td> </ Tr> </ tbody> </ table> </ form> " " <hr align = center noshade size = 1 width = "95%>" "</ center> </ div>"; out.print LTOP);%> <% // Displaying a page of the latest time Page 1 message countsql = "SELECT Count (lw_title) from guestbook" lwhere; inqsql = "select lw_title, answer_num, click_num, lw_author, lw_time, expres swiion," "Author_Email, LW_CLASS1, LW_CLASS2 from Guestbook" Lwhere "O Rder by LW_TIME DESC";</p> <p>IF (Pages> 0) {Try {Try {ResultSet Rcount = Testinq.executeQuery (Count.next ()) {count = rcount.getint (1);} rcount.close ();} catch (Exception EL1) {Out.Println ("Count Record Error:" EL1 "<br>"); out.println (countsql);} Totalpages = (int); if (count> Totalpages * Pagesize) Totalpages ; ST = "" "<table align = center border = 0 cellpadding = 0 cellspacing = 0 width =" 95% ">" "<tbody> <tr> <td align = middle bgcolor = # 97badd width =" 1 00%> <font color = # ff0000> " " Total " Totalpages " page, " ": " " Current Page: " Pages " </ font> </ td> </ tr> < / TBODY> </ table> <br></p> <p>Out.print (ST);</p> <p>//out.print ("Total" Totalpages "page," "" " " Current page: " Pages " <br> ");</p> <p>ST = "<center>" "<table border = 0 cellpadding = 2 cellspacing = 1 width =" 95% ">" "<tbody>" "<tr>" "<td align = middle bgcolor = # 6699cc width = "55%"> <font " " color = # fffff> Message topic </ font> </ td> " " <td align = middle bgcolor = # 6699cc width = 50> <font " " color = # ffffff> Number of responses </ font> </ td> " " <TD align = middle bgcolor = # 6699cc width = 40> <font " " color = # fffww> Clicks </ font> </ td> " " <Td align = middle bgcolor = # 6699cc width = 100> <font " " color = # fffww> Author name </ font> </ td> " " <TD align = middle bgcolor = # 6699cc width = 140> <font " " color = # ffffF> Published / response time </ font> </ td> </ tr> "; out.print (st); if (count> 0) {ResultSet RS = Testinq.executeQuery (Inqsql); ResultSetMetadata metadata = rs.getMetadata ();</p> <p>INT i; // Skip the Pages -1 page, make Cursor points to Pages and prepare for display for (i = 1; i <= (pages - 1) * Pagesize; i ) rs.next (); // Display Page Page Start String linestr = ""; for (i = 1; i <= pagesize; i ) = {lw_title = rs.getstring ("lw_title"); answer_num = rs.getint ("Answer_num") Click_num = rs.getint ("Click_NUM"); LW_AUTHOR = rs.getstring ("lw_author"); lw_time = rs.getstring ("lw_time"); st = lw_time.substring (0, 4) "-" LW_TIME .Substring (4, 6) "-" LW_TIME.SUBSTRING (6, 8) ":" LW_TIME.SUBSTRING (8, 10) ":" LW_TIME.SUBSTRING (10, 12) ":" LW_TIME.SUBSTRING (12,14); lw_ico = rs.getstring ("express"); author_email = rs.getstring ("author_email"); lw_class1 = rs.getstring ("lw_class1"); lw_class2 = rs.getstring (" lw_class2 "); llink =" reply.jsp lw_class1 = " lw_class1 " & lw_class2 = " lw_ class2 " & zt_time = " lw_time " & zt_author = " author_email; linestr ="? <TR bgColor = # d5e8fd> " " < TD BGCOLOR = # d5e8fd> <img src = " lw_ico ". GIF "> <a" "href="" llink ">" lw_title "</a </ td>" "<TD Align = Middle> [" Answer_num "] </ td> " " <TD align = middle> " Click_Num " </ TD> " " <TD A Lign = middle> <a href="mailto :" author_ema il ""> " LW_AUTHOR " </a> </ td> " " <</p> <p>TD align = middle> " st " </ td> </ tr> "; out.println (linestr);</p> <p>} rs.close (); // Display Page Page End ST = "</ tbody> </ table> <br>"; OUT.PRINT (ST);</p> <p>INT IFIRST = 1, ILAST = Totalpages, IPRE, INEXT; IF (Pages <= 1) ipre = 1; ELSE IPRE = Pages - 1;</p> <p>INEXT = Totalpages; else inext = pages 1;</p> <p>INT n = (int); if (n * pagesize <count) n ; if (n> 1) {// for (i = 1; i <= n; i ) Out.print ("< A href = incuire.jsp? pages = " "> i "</a>"); //out.print("hr align = center noshade size = 1 width = "95%>") String LT1 = "Return to Home", LT2 = "First Page", LT3 = "Previous", LT4 = "Next", LT5 = "Last Page", LT6 = ""; LT6 = "< A href = http://www.zj.hn.cn> " LT1 " </ a> " LURLT " Pages = " IFirst "> <font color = red> " lt2 " & nbs p; < / a> " LURLT " Pages = " ipre "> <font color = red> " lt3 " </a> " " "" "" inext "> <font color = red> lt4 "; </a>" LURLT "pages =" = = red> " lt5 "; </a> "; ST =" " " <table align = center border = 0 Cellpadding = 0 Cellspacing = 0 width = "95%"> " " <tbody> <tr> <TD align = middle bgcolor = # 97badd width = "1 00%> <font color = # ff0000>" lt6 "< / Font> </ td> </ tr> </ tbody> </ table> <br> "; Out.Print (ST);</p> <p>}</p> <p>}}} Catch (Exception E) {Out.println ("Error:" E);}}</p> <p>%></p> <p><% // message board boundary String Lbottom = ""; lbottom = lbottom "" "<form action = guestbook.jsp method = post name = Sign>" "<input name = GBNAME TYPE = Hidden value = cnzjj_gt> " " <Input name = Pages Type = hidden value = 1> " " <table border = # d5e8fd border = 0 Cellspacing = 1 width = "95%>" </p> <p><TBODY> " " <tr> " " <TD align = middle bgcolor = # e6e6fa colspan = 2 NOWRAP> <strong> <font color = blue " " face = 体 _GB2312 size = 5> < / Font> </ strong> & nbs P; [加 * content must be filled in] </ td> </ tr> <tr> " " <TD NOWRAP Width = "45%"> " " <DIV Align = Left> " " <table border = # d5e8fd border = 0 cellspacing = 1 width = "100%"> " " <tbody> " " <TR> " " <TD NOWRAP WIDTH = "100%" > * Message topic: <input maxlength = 40 n ame = lw_title " " size = 36> </ td> </ tr> " " <tr> " " <TD NOWRAP WIDTH = "100%> * Online Great Name: <Input Maxlength = 18 N AME = LW_AUTHOR " " size = 36> </ td> </ tr> " " <tr> " " <TD NOWRAP WIDTH = "100%> Home Title: <input MaxLength = 40 Name = PageTitle " " Size = 36> </ td> </ tr> " " <tr> " " <TD NOWRAP WIDTH = "100%> Home Address: <Input Maxlength = 255 Name = Author_http " " size = 36> </ td> </ tr> " " <tr> " " <TD NOWRAP WIDTH = "100%"> * Email: <Input Maxlength = 40 n ame = author_email " "size = 36> </ td> </ tr> </ tbody> </ Table> </ div> </ div> < " <TD NOWRAP VALIGN = Top Width = "55%"> " " <DIV Align =</p> <p>Left> " " <table border = # b6d7fc border = 0 cellspacing = 1 width = "100%>" "<tbody>" "<tr>" "<TD width =" 100% "> Please Fill in your message below: </ td> </ tr> " </p> <p><TR> " " <TD Width = "100%"> <textarea cols = 50 Name = LW_CONTENT ROWS = 7> </ TEXTAREA> </ TD> </ TR> </ tbody> </ table> </ Div> </ td> </ tr> " " <TD> " " <TD BGCOLOR = # fbf7ea colspan = 2 NOWRAP> expressions " " <input name = GIFFACE TYPE = Radio Value = 1 checked> <img " "alt =" 1.GIF (152 bytes) "Height = 15 src =" 1.gif "Width = 15> <i nput" "Name = Gifface Type = radio value = 2> <img alt =" 2. GIF (174 Bytes) "Height = 15" "SRC =" 2.gif "width = 15> <input name = giffact type = radio value = 3> <img" "alt =" 3.gif (147 bytes) "Height = 15 src =" 3.gif "width = 15> <i nput" "name = gifface type = radio value = 4> <img alt =" 4.gif (172 bytes) "Height = 15" " SRC = "4.gif" width = 15> <input name = GIFFACE TYPE = Radio value = 5> <img " " alt = "5.gif (118 bytes)" Height = 15 src = "5.gif" Width = 15> <i nput " " Name = gifface type = radio value = 6> <img alt = "6.gif (180 bytes)" Height = 15 " " src = "6.gif" width = 15> < Input name = gifface type = radio value = 7> <img " " alt = "7.gif (180 bytes)" Height = 15 src = "7.gif" Width = 15> <i nput " " name = GIFFACE Type = radio value = 8> <img a LT = "8.gif (96 bytes)"</p> <p>Height = 15 " " SRC = "8.gif" width = 15> <input name = gifface type = radio value = 9> <img " " alt = "9.gif (162 bytes)" Height = 15 SRC = "9.gif" width = 15> <i nput " " name = gifface type = radio value = 10> <img alt = "10.GIF (113 bytes)" Height = 15 " " src = "10.gif "width = 15> <input name = gifface type = radio value = 11> <img" "alt =" 11.gif (93 bytes) "Height = 15 src =" 11.gif "width = 15> <input" "Name = gifface type = radio value = 12> <img alt =" 12.gif (149 bytes) "Height = 14" "src =" 12.gif " " = 15> " " <input " " Name = gifface type = radio value = 13> <img alt = "13.gif (149 bytes)" Height = 14 " " src = "13.gif" width = 15> " " <input " " Name = GIFFACE TYPE = Radio Value = 14> <img alt = "14.gif (149 bytes)" Height = 14 " " src = "14.gif" Width = 15> " " <input " " name = GIFFACE TYPE = radio value = 15> <img alt = "15.gif (149 bytes)" Height = 14 " " src = "15.gif" width = 15> " " <input " " name = GIFFACE TYPE = RADIO Value = 16> <img alt = "16.GIF (149 bytes)" Height = 14 " " src = "16.gif" Width = 15> </ td> " " </ TR> " " <TR > " "</p> <p><TD align = middle colSpan = 2 noWrap> <INPUT name = cmdGO οnclick = "re turn ValidInput ()" type = submit value = "submit"> " " <INPUT name = cmdPrev οnclick = "return ValidInput ()" type = Submit Valu E = "Preview"> " " <input name = cmdcancel type = reset value = "rewrite"> <invu t name = cmdback οnclick = javascript: history.go (-1) type = button value = " Return ">" "</ td> </ tr> </ tbody> </ table> </ form> </ center> </ div>"; Out.Print (LBOTTOM);</p> <p>%></p> <p></ body> </ html></p> <p>Author: precom (eggs) 2000.12.10reply.jsp ==================================== <html> <head> <meta content = "text / html; charset = GB2312" http-equiv = content-type></p> <p><title> Zhangjiajie Telephone Yellow Pages (Online 114) </ title> </ head> <style type = "text / css"> <! - body {font-family: "Song", "Arial Narrow", "Times New Roman "; font-si ze: 9pt} .p1 {font-family:" Song "," Arial Narrow "," Times New Roman "; Font-Siz E: 12pt} A: Link {color: # 00793d; Text Decoration: none} A: visited {text-decoration: none} A: Hover {text-decoration: underline} TD {font-family: "Song", "Arial Narrow", "Times New Roman"; Font-size: 9pt } .p2 {font-family: "Song", "Arial Narrow", "Times New Roman"; Font-Siz E: 9pt; line-height: 150%} .p3 {font-family: "Song", "Arial Narrow "," Times New Roman "; Font-Siz E: 9pt; line-height: 120%} -> </ stop></p> <p><body></p> <p><% @ Page ContentType = "TEXT / HTML; Charset = GB2312"%> <% @ page language = "java" import = "java.sql. *"%> <jsp: usebean id = "testinq" scope = "Page "Class =" ymbean.opdb "/> <% int pages = 1; int pot = 0; int Totalpages = 0;</p> <p>String countsql = "", inqsql = ", updatesql =" ", lwhere =" ", insertsql =", st = ""</p> <p>String lw_title = "" ", lw_author =" ", pageTitle =" ", author_http =" ", author_e mail =" ", lw_ico =" 0 ", lw_content =" ", lw_class1 ="; string author_ip = ", lw_TIME = "" ", lw_class2 =", lw_type = ", zt _author =" "; int answer_num = 0, click_num = 0; int inquire_item = 1; string inquire_itemt =", inquire_value = " String Lurlt = "<a href = reply.jsp?"; Lwhere = "where"; // only display the primary post</p> <p>/ * Enumeration E = Request.getParameterNames (); while (E.hasMoreElements ()) {string name = (String) E.NEXTELEMENT (); * / try {// Take the displayed page page PageS = New Integer (Request " .GetParameter ("pages")). INTVALUE ();} catch (exception e) {} try {// Take the query parameter LW_CLASS1 = New String (Request.GetParameter). getBytes ("ISO8859_1"); lw_class2 = new String (request.getParameter ( "lw_class2") getBytes ( "ISO8859_1").); zt_time = new String (request.getParameter ( "zt_time") getBytes ( "IS O8859_1").); zt_author = new String ( Request.getParameter ("zt_author"). GetBytes ("ISO8859_1");</p> <p>lwhere = "where (lw_class1 = '" lw_class1 "' and lw_class2 = '" lw_ class2 "' and (lw_time = '" zt_time "' or zt_time = '" zt_time "') and (author_email = '" zt_author " 'or zt_author ='" zt _author " '))"; lurlt = lurlt "lw_class1 =" lw_class1 "& lw_class2 =" lw_class2 "& zt _time =" zt_time "& zt_author =" zt_author "&"; / . getParameter ( "lw_class1") getBytes ( "ISO 8859_1"));. lw_class2 = new String (request.getParameter ( "lw_class2") getBytes ( "ISO 8859_1"));. lw_title = new String (request.getParameter ( "lw_title ") .Getbytes (" ISO88 59_1 ")); lw_author = new string (Request.GetParameter (" LW_AUTHOR "). GetBytes (" ISO 8859_1 "); pageTitle = new string (Request.getParameter (" PageTitle "). Getbytes ( "ISO 8859_1")); author_http = new String (request.getParameter ( "author_http") getBytes ( "ISO8859_1"));.. author_email = new String (request.getParameter ( "author_email") getByte s ( "ISO8859_1" )); zt_time = new string (Reques T.GetParameter ("zt_time"). getBytes ("ISO8859 _1")); zt_author = new string (Request.GetParameter ("zt_author"). GetBytes ("ISO 8859_1")); lw_ico = request.getParameter ("gifface" );</p> <p>} catch (exception e) {}</p> <p>try {lw_content = new String (request.getParameter ( "lw_content") getBytes ( "I SO8859_1").); String requestMethod = request.getMethod (); requestMethod = requestMethod.toUpperCase (); if (requestMethod.indexOf ( "POST ") <0) {OUT.PRINT (" illegal operation! "); Return;} // form additional data item author_ip = request.getRemoteAddr (); lw_time = testinq.getcurrentdate (" YYYYMMDDHHMMSS "); lw_type =" " "c"; // from the posted answer_num = 0; click_num = 0; // ========================= "; // guarantee all data items Length in the normal range IF (LW_TILE.LENGTH ()> 50) LW_TITLE = LW_TILE.SUBSTRING (0, 50); if (lw_author.length ()> 20) LW_AUTHOR = LW_AUTHOR.SUBSTRING (0, 20); if (author_http .length ()> 40) Author_http = author_http.substring (0,40);</p> <p>IF (Author_Email.Length ()> 50) Author_email = author_email.substring (0,40); if (zt_author.length ()> 50) zt_author = zt_author.substring (0,40); if (lw_content.length () > 4000) LW_CONTENT = LW_CONTENT.SUBSTRING (0,4000);</p> <p>insertsql = "insert into guestbook values ​​( '" lw_title st lw_author st author_http st author_email st lw_ico st lw_time "'," answer_num "," cli ck_num ", '" author_ip st lw_class1 st lw_class2 st lw_type st zt_time st zt_author st lw_content " ')"; //out.print(insertsql); // insert message try {st = testInq.executeUpdate (insertsql); IF ("ExecuteUpdate OK") <0) Out.print ("msg =" st); else {updatesql = "Update guestbook set answer_num = answer_num 1" l where; // increase replies statistics Try {st = testinq.executeUpdate (updatesql); if ("ExecuteUpdate OK") <0) Out.print ("MSG =" st);} catch (exception e) {}}} catch (Exception e) {OUT.PRINT ("Message error: E);}} Catch (Exception E) {}%></p> <p><% // Verify the JavaScript string ljs = "<script language = javascript>" "<! " <" " {If (document.sign.lw_author.valument.sign.lw_author.value = = "" " " {Alert ("Please fill in your name."); " " Document.sign.LW_AUTHOR.FOCUS (); " " Return False;} " " f (Document.sign.LW_TITLE .Value == "" " " {Alert ("Please fill in the message topic."); " " Document.sign.LW_TITLE.FOCUS (); " " Return False;} " " f (Document.sign .author_email.value! = "" " " {IF ((Document.Sign.Author_Email.Value.Indexof ("@") <0) // (Document. Sign.Author_Email.Value.Indexof (":") ! = - 1)) " " {Alert ("The email you fill in is invalid, please fill in an effective email!"); " " Document.Sign.author_emaill.focus (); " " Return False; " "}" "}" "}" "}" "function validsearch ()" "{if (Document.frmsearch.FindStr.Value ==") " " {Alert ("You can't search Empty string! ");" "Document.frmsearch.FindStr.focus ();" "Return False;}" "}" "// ->" "</ script>"; out.print (ljs);%> <% // Display a page of the latest time published a message countsql = "SELECT Count (lw_title) from guestbook" lwhere; inqsql = "select lw_title, lw_author, lw_time, lw _Content, Author_IP, " " Author_Email from Guestbook " Lwhere " ORDER BY LW_TIME DESC "; UPDATESQL =" Update Guestbook Set Click_Num = Click_Num 1 " lwhere;</p> <p>// Increase the number of browsing people Try {st = testinq.executeUpdate (updateSQL); if ("ExecuteUpdate OK" <0) Out.print ("MSG =" st);} catch (exception e) { } // out.print (inqsql); if (pages> 0) {TRY {Try {resultset rount = testinq.executeQuery (countsql); if (rcount.next ()) {count = rcount.getint (1);} Rcount.close ();} catch (Exception EL1) {Out.println ("Count Record Error:" EL1 "<br>"); Out.Println (countsql);}</p> <p>Totalpages = (int); if (count> Totalpages * Pagesize) Totalpages ; ST = " " <Table Align = Center Border = 0 Cellpadding = 0 Cellspacing = 0 width = "95%>" "<Tbody> <tr> <td align = middle bgcolor = # 97badd width =" 1 00%> <font color = # ff0000> " " Totalpages "page," ")." " Current page: " Pages " </ font> </ td> </ tr> </ tbody> </ table> <br></p> <p>Out.print (ST);</p> <p>//out.print ("Total" Totalpages "page," "" " " Current page: " Pages " <br> ");</p> <p>ST = "<center>" "<table border = 0 cellpadding = 2 cellspacing = 1 width =" 95% ">" "<tbody>" "<tr>" "<td align = middle bgcolor = # 6699cc width = "55%"> <font " " color = # fffff> Message topic </ font> </ td> " " <TD align = middle bgcolor = # 6699cc width = 50> <font " " color = # ffffff> Number of responses </ font> </ td> " " <TD align = middle bgcolor = # 6699cc width = 40> <font " " color = # fffww> Clicks </ font> </ td> " " <Td align = middle bgcolor = # 6699cc width = 100> <font " " color = # fffww> Author name </ font> </ td> " " <TD align = middle bgcolor = # 6699cc width = 140> <font " " color = # ffffF> Published / response time </ font> </ td> </ tr> "; //out.print(st) {ResultSet RS = Testinq .ExecuteQuery; ResultSetMetadata metadata = rs.getMetadata ();</p> <p>INT i; // Skip the Pages -1 page, make Cursor points to Pages and prepare for display for (i = 1; i <= (pages - 1) * Pagesize; i ) rs.next (); // Display Page Page Start ST = "<center> <table border = 0 cellspacing = 1 width =" 95% "> <tbody>"; out.print (st); string linestr = ""; for (i = 1; i <= PageSize i ) {lw_title = rs.getstring ("lw_title"); lw_author = rs.getstring ("lw_author"); lw_time = rs.getstring ("lw_time"); lw_content = rs.getstring ("LW_CONTENT"); author_ip = rs.getstring ("author_ip"); author_email = rs.getstring ("author_email"); st = lw_time.substring (0, 4) "-" LW_TIME.SUBSTRING (4, 6 ) "-" LW_TIME.SUBSTRING (6, 8) ":" LW_TIME.SUBSTRING (8, 10) ":" LW_TIME.SUBSTRING (10, 12) ":" LW_TIME.SUBSTRING (12 , 14); try {lw_content = testinq.addbr (Testinq.RemoveComment);} catch (Exception E) {} linestr = " " <tr bgcolor = # BED9FC> " " <TD align = Left Width = "75%"> <font " " color = # 0000cd> message topic: </ font> <strong> " lw_title " </ strong> </ td> " " <td align = left width = " 25%> <font color = # 0000cd> Message time: </ font> " " </ td> </ tr> " <tr bgcolor = # e7f1fe>" "<TD colSpan = 2 " " width = "700" wrap = yes> <BR> " lw_content " <BR> <br> </ TD> </ TR> " " <TR bgColor = # bed9fc> " " <TD align = Right Colspan =</p> <p>2 width = "100%"> <FONT " " color = # 0000cd> of: </ FONT> " lw_author " <FONT " " color = # 0000cd> Source: </ FONT> " author_ip " </ TD> </ tr> "; out.println (LINESTR);}}}}} =" </ tbody> </ table> </ center> </ div> <br > " </p> <p>"<Center> <a" href="guestbook.jsp"> <font " " color = blue face = 体 _GB2312 size = 4> Return message board home page </ font> </a </ center> <br> " " <hr align = center noshade size = 1 width = "95%"></p> <p>Out.print (ST);</p> <p>INT IFIRST = 1, ILAST = Totalpages, IPRE, INEXT; IF (Pages <= 1) ipre = 1; ELSE IPRE = Pages - 1;</p> <p>INEXT = Totalpages; else inext = pages 1;</p> <p>INT n = (int); if (n * pagesize <count) n ; if (n> 1) {// for (i = 1; i <= n; i ) Out.print ("< A href = incuire.jsp? pages = " "> i "</a>"); //out.print("hr align = center noshade size = 1 width = "95%>") String LT1 = "Return to Home", LT2 = "First Page", LT3 = "Previous", LT4 = "Next", LT5 = "Last Page", LT6 = ""; LT6 = "< A href = http://www.zj.hn.cn> " LT1 " </ a> " LURLT " Pages = " IFirst "> <font color = red> " lt2 " & nbs p; < / a> " LURLT " Pages = " ipre "> <font color = red> " lt3 " </a> " " "" "" inext "> <font color = red> lt4 "; </a>" LURLT "pages =" = = red> " lt5 "; </a> "; ST =" " " <table align = center border = 0 Cellpadding = 0 Cellspacing = 0 width = "95%"> " " <tbody> <tr> <TD align = middle bgcolor = # 97badd width = "1 00%> <font color = # ff0000>" lt6 "< / Font> </ td> </ tr> </ tbody> </ table> <br> "; Out.Print (ST);</p> <p>}</p> <p>}}} Catch (Exception E) {Out.println ("Error:" E);}}</p> <p>%></p> <p><% // message board boundary String Lbottom = "; lbottom = lbottom " <center> " " <form action = reply.jsp method = post name = Sign> " " <input name = lw_class1 type = Hidden Value = cnzjj_gt> " " <input name = lw_class2 type = hidden value = " lw_class2 "> " " <input name = pages type = hidden value = 1> " <input name = zt_time type = hidden value =" ZT_TIME ">" "<input name = zt_author type = hidden value =" zt_author ">" "<table border = # d5e8fd border = 0 Cellspacing = 1 width =" 95%> " </p> <p><TBODY> " " <tr> " " <TD align = middle bgcolor = # e6e6fa colspan = 2 NOWRAP> <strong> <font color = blue " " face = 体 _GB2312 size = 5> < / Font> </ strong> & nbs P; [加 * content must be filled in] </ td> </ tr> <tr> " " <TD NOWRAP Width = "45%"> " " <DIV Align = Left> " " <table border = # d5e8fd border = 0 cellspacing = 1 width = "100%"> " " <tbody> " " <TR> " " <TD NOWRAP WIDTH = "100%" > * Message topic: <input maxlength = 40 n ame = lw_title " " size = 36> </ td> </ tr> " " <tr> " " <TD NOWRAP WIDTH = "100%> * Online Great Name: <Input Maxlength = 18 N AME = LW_AUTHOR " " size = 36> </ td> </ tr> " " <tr> " " <TD NOWRAP WIDTH = "100%> Home Title: <input MaxLength = 40 Name = PageTitle " " Size = 36> </ td> </ tr> " " <tr> " " <TD NOWRAP WIDTH = "100%> Home Address: <Input Maxlength = 255 Name = Author_http " " size = 36> </ td> </ tr> " " <tr> " " <TD NOWRAP WIDTH = "100%"> * Email: <Input Maxlength = 40 n ame = author_email " "size = 36> </ td> </ tr> </ tbody> </ Table> </ div> </ div> < " <TD NOWRAP VALIGN = Top Width = "55%"> " " <DIV Align =</p> <p>Left> " " <table border = # b6d7fc border = 0 cellspacing = 1 width = "100%>" "<tbody>" "<tr>" "<TD width =" 100% "> Please Fill in your message below: </ td> </ tr> " </p> <p><TR> " " <TD Width = "100%"> <textarea cols = 50 Name = LW_CONTENT ROWS = 7> </ TEXTAREA> </ TD> </ TR> </ tbody> </ table> </ Div> </ td> </ tr> " " <TD> " " <TD BGCOLOR = # fbf7ea colspan = 2 NOWRAP> expressions " " <input name = GIFFACE TYPE = Radio Value = 1 checked> <img " "alt =" 1.GIF (152 bytes) "Height = 15 src =" 1.gif "Width = 15> <i nput" "Name = Gifface Type = radio value = 2> <img alt =" 2. GIF (174 Bytes) "Height = 15" "SRC =" 2.gif "width = 15> <input name = giffact type = radio value = 3> <img" "alt =" 3.gif (147 bytes) "Height = 15 src =" 3.gif "width = 15> <i nput" "name = gifface type = radio value = 4> <img alt =" 4.gif (172 bytes) "Height = 15" " SRC = "4.gif" width = 15> <input name = GIFFACE TYPE = Radio value = 5> <img " " alt = "5.gif (118 bytes)" Height = 15 src = "5.gif" Width = 15> <i nput " " Name = gifface type = radio value = 6> <img alt = "6.gif (180 bytes)" Height = 15 " " src = "6.gif" width = 15> < Input name = gifface type = radio value = 7> <img " " alt = "7.gif (180 bytes)" Height = 15 src = "7.gif" Width = 15> <i nput " " name = GIFFACE Type = radio value = 8> <img a LT = "8.gif (96 bytes)"</p> <p>Height = 15 " " SRC = "8.gif" width = 15> <input name = gifface type = radio value = 9> <img " " alt = "9.gif (162 bytes)" Height = 15 SRC = "9.gif" width = 15> <i nput " " name = gifface type = radio value = 10> <img alt = "10.GIF (113 bytes)" Height = 15 " " src = "10.gif "width = 15> <input name = gifface type = radio value = 11> <img" "alt =" 11.gif (93 bytes) "Height = 15 src =" 11.gif "width = 15> <input" "Name = gifface type = radio value = 12> <img alt =" 12.gif (149 bytes) "Height = 14" "src =" 12.gif " " = 15> " " <input " " Name = gifface type = radio value = 13> <img alt = "13.gif (149 bytes)" Height = 14 " " src = "13.gif" width = 15> " " <input " " Name = GIFFACE TYPE = Radio Value = 14> <img alt = "14.gif (149 bytes)" Height = 14 " " src = "14.gif" Width = 15> " " <input " " name = GIFFACE TYPE = radio value = 15> <img alt = "15.gif (149 bytes)" Height = 14 " " src = "15.gif" width = 15> " " <input " " name = GIFFACE TYPE = RADIO Value = 16> <img alt = "16.GIF (149 bytes)" Height = 14 " " src = "16.gif" Width = 15> </ td> " " </ TR> " " <TR > " "</p> <p><TD align = middle colSpan = 2 noWrap> <INPUT name = cmdGO οnclick = "re turn ValidInput ()" type = submit value = "submit"> " " <INPUT name = cmdPrev οnclick = "return ValidInput ()" type = Submit Valu E = "Preview"> " " <input name = cmdcancel type = reset value = "rewrite"> <invu t name = cmdback οnclick = javascript: history.go (-1) type = button value = " Return ">" "</ td> </ tr> </ tbody> </ table> </ form> </ center> </ div>"; Out.Print (LBOTTOM);</p> <p>%></p> <p></ body> </ html></p> <p>Servers: precom (Pather) 2000.12.10</p> <p>Author: precom (eggs) which opDb.java ======================================= ===== Package ymbean;</p> <p>Import java.sql. *; import java.util. *; import java.text. *; import com.chinazjj.sql.dsql; import com.chinazjj.util.dutil;</p> <p>// Other bags DSQL, the content in DUTIL is no longer posted, and the two functions used in this document are very simple.</p> <p>Single public class opdb {</p> <p>Private string inquire_value = "", incuire_item = "", disptype = ", inqtyp</p> <p>E = ""; private string inquire_num = "", incuire_addr = "", inquire_name = ""; private dutil ldutil = new dutil (); public opdb () {</p> <p>}</p> <p>Public void setinquire_item (string name) {incnire_Item = name</p> <p>;} public void setinquire_value (string name) {incuire_value = ldut</p> <p>Il.chinesetounicode (name);} public void setdisptype (string name) {disptype = name;} public void setinqtype (string name) {INQTYPE = Name;}</p> <p>Public void setinquire_num (string name) {incuire_num = ldutil.chinesetounicode (name); public void setinquire_addr (string name) {incnire_addr = ldutil</p> <p>.chinesetounicode (name);} public void setinquire_name (String name) {incnire_name = ldutil</p> <p>.CHINESETOUNICODE (NAME);</p> <p>Public string getinquire_dndata () {return ";</p> <p>public ResultSet executeQuery (String sql) {ResultSet rs = null; Statement lstmt = null; try {lstmt = connectdb (); rs = lstmt.executeQuery (sql); System.out.println ( "executeQuery:" sql);} Catch (Sqlexception EX) {System.err.Println ("ExecuteQuery:" </p> <p>EX.getMessage ());} Return Rs;}</p> <p>Public statement getStmt () {statement LSTMT = NULL; LSTMT = ConnectDb (); Return LSTMT;}</p> <p>public String executeUpdate (String sql) {ResultSet rs = null; Statement lstmt = null; try {lstmt = connectdb (); lstmt.executeUpdate (sql); System.out.println ( "executeUpdate:" sql); lstmt.executeUpdate ("commit");} catch (sqlexception ex) {system.err.println ("ExecuteQuery:" E</p> <p>x.getMessage ()); return (ex.getMessage ());} Return ("ExecuteUpdate OK");</p> <p>Public statement connectdb () {</p> <p>STATEMENT LSTMT = NULL; connection conn = NULL;</p> <p>Final String Connect_String = "JDBC: Oracle: Thin: Scott/tiger@192.168.</p> <p>0.1: 1521: Clubdb "; Final String Driver_String =" Oracle.jdbc.driver.Oracledriver "; DSQL mysql = new dsql (); lstmt = mysql.dconnectdb (driver_string, connection_string); return LSTMT;}</p> <p>Public Statement Connectdb (String Connect_string) {statement LSTMT = NULL; Connection Conn = NULL;</p> <p>final String driver_string = "oracle.jdbc.driver.OracleDriver"; dsql mysql = new dsql (); lstmt = mysql.dconnectdb (driver_string, connect_string); return lstmt;} // ========= other function ====================================</p> <p>Public String getCurrentDate (String Ldateform) {return (new simpledateformat (ldateform) .format (new java.util.date) (NEW JAVA.UTIL.DATE</p> <p>))))));</p> <p>/ / ======== "/ n" to "<br>" =============================== ======= // Remove the strange: public string removecomment (string content) {string makecontent = new string (); stringtokenizer stranden = new stringtokenizer (content, ""); string temptoken = null;</p> <p>While (STRTOKEN.HASMORETOKENS ()) {Temptoken = startken.nextToken (); if (Temptoken.Indexof (":")! = 0) Makecontent = Makecontent Temptoken ";} Return Makecontent;</p> <p>// The / n converted into the transport <br> public String addBr (String Content) {String makeContent = new String (); StringTokenizer strToken = new StringTokenizer (Content, ""); while (strToken.hasMoreTokens ()) {makeContent = Makecontent "<br>" strtoken.nextToken ();} returnome</p> <p>// Transition <br> converted into a carriage / n public string addCR (String Makecontent = new string (); StringTokenizer Strtoken = New StringTokenizer (Content, "<br>"); while (STRTOKEN.HASMORETOKENS () ) {makecontent = makecontent "" strtoken.nextToken ();} return makecontent;} // ========================================================================= ========================================</p> <p>===== Public boolean getidentify (string name1, string pwd1) {Try {string sql = "select * from club_users where username = '" name1 ""</p> <p>And password = '" pwd1 "' "; resultset = executeQuery (SQL); if (rs.next ()) {r.close (); return (true);} else {rclose (); return (false);}}}}}}}}}}}}}}} Catch (Exception E) {Return (false);}}</p> <p>Public void counts (string pagename) {ExecuteUpdate ("Update call_count set counts = counts 1 where Pagenam</p> <p>E = '" PageName "' ");</p> <p>}</p> <p>/ / ================== Zhangjiajie citizen virtual community management =========================== ===</p> <p>====== Public String getDeptsuper (String VP) // Appries the master {string vSt = "unknown"; try {string sql = "select administrator from club_cvcdept where deptno =</p> <p>'" VP "' "; ResultSet RS = ExecuteQuery (SQL); if (rs.next ()) vSt = rs.getstring (1); rs.close ();} catCH (Exception E) {} Return VST; } public String getDeptName (String vp) // take Version name {String vst = "unknown"; try {String sql = "select deptnote from club_cvcdept where deptno = '" vp "'"; ResultSet rs = executeQuery (sql); IF (rs.next ()) vst = rs.getstring (1); rs.close ();} Catch (Exception E) {} Return VST;}</p> <p>Public String GetUseremail (String VP) // Take the community user email {string vst = "unknown"; try {string sql = "SELECT Email from club_users where username = '" vp "'</p> <p>"; ResultSet RS = EXECUTEQUERY (SQL); if (rs.next ()) vst = rs.getstring (1); rs.close ();} Catch (Exception E) {} Return VST;}</p> <p>Public Object getavalue (String VP) // Take a community user Email and other {Object vst = null; try {string sql = vp; resultset = executeQuery (SQL); if (rs.next ()) vst = rs.getObject 1);} Catch (Exception E) {} Return VST;}</p> <p>Public String GetSValue (String VP) // Take the community user email and other {string vSt = ""; try {string sql = vp; resultset = executeQuery (SQL); if (rs.next ()) vst = rs.getstring (1);} Catch (Exception E) {} Return VST;</p> <p>} // end opdb.java</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-17350.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="17350" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.035</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = '_2FZjVXRmKH_2B_2BhJh_2FEHU_2BbAJPkRxOcb8gXr9TKeWEL2mcCWYQ9GkjRm3C_2BmzFY2lN3pbuAe7OneY7PPQUz'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>