<% @ page import = "java.sql. *"%>
add message inTo Table title> head> < % String name = request.getParameter ("name"); string mail = request.getParameter ("mail"); string title = request.getParameter ("Title"); string content = request.getParameter ("content"); if (Name == NULL) Name = ""; if (title == NULL) Title = ""; if (content == NULL) Content = ""; if (mail == null) Mail = ""; if (Name .length () == 0) Out.println ("The name of the message cannot be empty!"); else if (title.length () == 0) Out.println ("message theme can not be empty!"); Else IF (content.length () == 0) Out.println ("message content is not empty!"); else {java.util.date Date = new java.util.date (); string datetime = new timestamp (Date .gettime ()). TOSTRING (); Try {class.forname ("sun.jdbc.odbc.jdbcodbcdriver); string url =" jdbc: odbc: user_db "; connection con = drivermanager.getConnection (URL," Inso " , "Insher"); preparedStatement Stm = Con.PrepareStatement ("Insert Into Message Values (?,?,?,?)"); stm.setstring (1, title); stm.setstring (2, name); IF (mail.length () == 0) stm.setstring (3, null); ELS E stm.setstring (3, mail); stm.setstring (4, datetime); stm.setstring (5, content); try {stm.executeQuery ();} catch (exception e) {}con.close (); } Catch (Exception E) {}%>
<%}%> body> html>
address message inTo Table <
/ Title> head>
<% string name = request.getParameter ("name"); string mail = request.getParameter ("mail"); string title = request.getParameter ("Title"); string Content = Request.getParameter ("content"); if (name == null) Name = ""; if (title == null) title = ""; if (content == null) content = "; if (mail = = NULL) MAIL = ""; if (name.length () == 0) Out.println ("The name of the message cannot be empty!"); Else IF (title.length () == 0) Out.println "The message theme can not be empty!"); Else IF () == 0) Out.println ("message content is not empty!"); Else {java.util.date Date = new java.util. Date (); string datetime = new timestamp (Date.getTime ()). TOSTRING (); try {class.forname ("sun.jdbc.odbc.jdbcodbcdriver); string url =" jdbc: odbc: user_db "; connection Con = DriverManager.getConnection (URL, "Inso", "Insher"); preparedStatement Stm = Con.PrepareStatement ("Insert Into Message Values (?,?,?,?,?)"; stm.setstring (1, Title ); stm.setstring (2, name); if (mail.length () == 0) stm.setstring (3, null); else stm.setstring (3, mail); stm.setstring (4, datetime); Stm.setstring (5, content); try {stm.executeQuery ();} catch (exception e) {} con.close ();} catch (exception e) {}%>
<%}%> body> < / html>
message board title> head>
Bordercolorlight = "# 88a6dd">
Visitor message board td> |
|