<% @ Page Import = "java.sql. *"%>
add message inTo Table </ title></p>
<p></ HEAD></p>
<p><Body></p>
<p><%</p>
<p>String name = Request.getParameter ("name");</p>
<p>String mail = Request.getParameter ("mail");</p>
<p>String title = Request.getParameter ("Title");</p>
<p>String content = Request.getParameter ("Content");</p>
<p>IF (Name == Null)</p>
<p>Name = ""</p>
<p>IF (title == NULL)</p>
<p>Title = "";</p>
<p>IF (content == NULL)</p>
<p>""; "</p>
<p>IF (mail == null)</p>
<p>Mail = ""</p>
<p>IF (Name.length () == 0)</p>
<p>Out.println ("The name of the message cannot be empty!");</p>
<p>Else IF (title.length () == 0)</p>
<p>Out.println ("" The theme of the message cannot be empty! ");</p>
<p>Else IF (content.length () == 0)</p>
<p>Out.println ("The message cannot be empty!");</p>
<p>Else</p>
<p>{</p>
<p>Java.util.date Date = new java.util.date ();</p>
<p>String datetime = new timestamp (date.gettime ()). TOSTRING ();</p>
<p>try {Class.forName ( "sun.jdbc.odbc.JdbcOdbcDriver"); String url = "jdbc: odbc: user_db"; Connection con = DriverManager.getConnection (url, "insher", "insher"); PreparedStatement stm = con .preparestatement (",,?,?,?,?)"); 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) {}%> <jsp: forward point = "view_message.jsp" /> <%}%> </ body> </ html></p>
<p><! - add_message.jsp - <% @ page import = "java.sql. *"%> <html> <head> <title> add message inTo Table </ title> </ head> <body> <% 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 topic 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.jdbcodbcodbdriver"); string url = "jdbc: odbc: user_db"; connection con = DRIVERMANAGER.GETCONNECTION (URL, "Insher", "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) {}%> <jsp: forward page = "View_message.jsp" /> <%}%> </ body> </ html></p>
<p><! - index.html -> <html> <head> <title> message board </ title> </ head> <body> <table width = "90%" align = "center" border = 1 cellspacing = "0" cellpadding = "0" bordercolordark = "# 88A6DD" bordercolorlight = "# 8886dd"> <tr> <td align = "center" BGColor = "# 8886dd"> Visitor message board </ td> </ tr> < Tr> <TD> <table align = "center" border = 1 cellspacing = "0" cellpadding = "0" bordercolordark = "# 88A6DD" Bordercolorlight = "# 8886dd"> <form action = "add_message.jsp"> <TR > <TD> Name: </ TD> <TD BGColor = "# 88A6DD"> <input type = "text" name = "name" size = 25> </ td> </ tr> <tr> <td bgcolor = "# 88a6dd"> e-mail: </ td> <td bgcolor = "# 88A6dd"> <input type = "text" name = "mail" size = 25> </ td> </ tr> <tr> < TD> Topic: </ TD> <TD BGCOLOR = "# 88a6dd"> <input type = "text" name = "title" size = 25> <td> <TR> <TD Valign = "TOP "BGCOLOR =" # 88A6DD "> Message: </ td> <TD> <textarea name =" Content "rows = 7 cols = 25> </ textarea> </ td> </ tr> <tr> <td colspan = 3> <table align = "center" width = "100%" cellspacing = "0" cellpadding = "0" bordercolordark = "# 88A6DD" Bordercolorlight = "# 88A6DD"> <TR> <TD align =</p>
<p>"center" bgcolor = "# 88a6dd"> <input type = "submit" value = "Submit Message"> </ td> <TD align = "center"> <a href="view_message.jsp"> <font size = 2> View message </ font> </a> </ td> <td align = "center" bgcolor = "# 88A6DD"> <input type = "reset" value = "Re-filing"> </ td> </ Tr> </ table> </ td> </ tr> </ form> </ table> </ td> </ tr> </ table> </ body> </ html></p>
<p><Html> <head> <title> message board </ title> </ head> <body> <table width = "60%" align = "center" border = 1 cellspacing = "0" cellpadding = "0" bordercolordark = "# 88a6dd" bordercolorlight = "# 888a6dd"> <tr> <td align = "center" BGColor = "# 88A6DD"> Visitor message board </ td> </ tr> <TR> <TD> <Table Align = " Center "border = 1 cellspacing =" 0 "cellpadding =" 0 "bordercolordark =" # 88a6dd "bordercolorlight =" # 888a6dd "> <form action =" add_message.jsp "> <TR> <TD> Name: </ td> <TD BGCOLOR = "# 88A6DD"> <input type = "text" name = "name" size = 25> <td> </ tr> <tr> <td bgcolor = "# 88a6dd> E-mail: < / TD> <TD BGCOLOR = "# 88a6dd"> <input type = "text" name = "mail" size = 25> <td> </ tr> <TD> <TD> topic: </ td> <TD BGColor = "# 88a6dd"> <input type = "text" name = "title" size = 25> <td> </ tr> <tr> <td valign = "top" bgcolor = "# 88A6dd"> message: </ Td> <TD> <textarea name = "content" rows = 7 cols = 25> </ textarea> </ td> </ tr> <tr> <td colspan = 3> <table align = "center" width = "100%" cellspacing = "0" cellpadding = "0" bordercolordark = "# 88A6DD" bordercolorlight = "# 88a6dd"> <tr> <td align = "center"</p>
<p>BGColor = "# 88A6DD"> <input type = "submit" value = "Submit Message"> </ td> <TD align = "center> <a href="view_message.jsp"> <font size = 2> View Message </ font> </a> </ td> <td align = "center" bgcolor = "# 88A6DD"> <input type = "reset" value = "Re-filing"> </ td> </ tr> < / Table> </ td> </ tr> </ form> </ table> </ td> </ tr> </ table> </ body> </ html></p>
<p><! - view_message.jsp -> <% @ page import = "java.sql. *"%> <html> <head> <title> show the message in the table </ title> </ head> <body > <p align = "center"> All guest messages </ p> <hr> <% try {class.forname ("sun.jdbc.odbc.jdbcodbcdriver"); string url = "jdbc: odbc: user_db"; connection con = DriverManager.getConnection (url, "insher", "insher"); Statement stm = con.createStatement (); ResultSet result = stm.executeQuery ( "select count (*) from message"); int message_count = 0; if (result.next ()) {Message_count = Result.Getint (1); Result.close ();} if (Message_Count> 0) {result = stm.executeuery ("Select * from message order by time desc"; while (Result.Next ()) {string title = result.getstring ("Title"); string name = result.getstring ("name"); string mail = result.getstring ("mail"); timestamp time = result.gettimestamp ("time"); date date_time = new date (time.gettime ()); time time_time = new time (time.gettime ()); string content = result.getstring ("content");%> <Table Width = "100%" align = "center" border = 1 cellspacing = "0" cellpadding = "0" borde Rcolordark = "# 000000" Bordercolorlight = "# 888a6dd"> <tr> <td bgcolor = "# 88A6DD"> <font size = 2> topic: </ font> </ td> <td colspan = 3> <% = Title%> </ td> </ tr> <tr> <td bgcolor = "# 88A6DD"> <font size = 2> Message: </ font> </ td> <td> <% = Name%> < / TD> <TD BGCOLOR = "# 88A6DD"> <</p>
<p>FONT SIZE = 2> E-mail: </ font> </ td> <TD> <% out.println ("<a href = mailto:" mail ">" mail "</a>");% > </ td> </ tr> <tr> <td bgcolor = "# 88a6dd"> <font size = 2> Message time: </ font> </ td> <td colspan = 3> <% out.println <font size = 2> " date_time " time_time "</ font>");%> </ td> </ tr> <tr> <td align = "center> <% out.println (" (" Message_Count ") ")");%> </ td> <td colspan = 3> <% = content%> </ td> </ tr> </ table> <% out.println ("<hr>" ); message_count--;} result.close (); con.close ();} else {out.println ("There is currently no message!"); con.close ();}} catch (exception e) { Out.println (E);}%> <p align = "center"> <a href="../message/index.html"> I want to leave a message </ p> </ body> </ HTML></p>
<p><! - view_message.jsp -> <% @ page import = "java.sql. *"%> <html> <head> <title> show the message in the table </ title> </ head> <body > <p align = "center"> All guest messages </ p> <hr> <% try {class.forname ("sun.jdbc.odbc.jdbcodbcdriver"); string url = "jdbc: odbc: user_db"; connection con = DriverManager.getConnection (url, "insher", "insher"); Statement stm = con.createStatement (); ResultSet result = stm.executeQuery ( "select count (*) from message"); int message_count = 0; if (result.next ()) {Message_count = Result.Getint (1); Result.close ();} if (Message_Count> 0) {result = stm.executeuery ("Select * from message order by time desc"; while (Result.Next ()) {string title = result.getstring ("Title"); string name = result.getstring ("name"); string mail = result.getstring ("mail"); timestamp time = result.gettimestamp ("time"); date date_time = new date (time.gettime ()); time time_time = new time (time.gettime ()); string content = result.getstring ("content");%> <Table Width = "100%" align = "center" border = 1 cellspacing = "0" cellpadding = "0" borde Rcolordark = "# 000000" Bordercolorlight = "# 888a6dd"> <tr> <td bgcolor = "# 88A6DD"> <font size = 2> topic: </ font> </ td> <td colspan = 3> <% = Title%> </ td> </ tr> <tr> <td bgcolor = "# 88A6DD"> <font size = 2> Message: </ font> </ td> <td> <% = Name%> < / TD> <TD BGCOLOR = "# 88A6DD"> <</p></div><div class="text-center mt-3 text-grey">
转载请注明原文地址:https://www.9cbs.com/read-41787.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="41787" 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.038</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 = 'QWmiRLNFcwb_2BbPb6OTqGmJLRnM8_2B9UOBYcXoRTApJ1Rbzb8qqizJBqFteeZ5CaJ5sgpcM7KwvJtC26C3WDvo6Q_3D_3D';
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>