! -- Add_message.jsp -- % @ pageimportjava. SQL. * % parameters % Stringnamerequest. getParameter (name); Stringmailrequest. getParameter (mail); Stringtitlerequest. getParameter (title); Stringconte SQL Server
<% @ Page import = "java. SQL. *" %>
Add message into table
<%
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 contact name cannot be blank! ");
Else if (title. length () = 0)
Out. println ("The message subject cannot be blank! ");
Else if (content. length () = 0)
Out. println ("the message content cannot be blank! ");
Else
{
Java. util. Date date = new java. util. Date ();
String datetime = new Timestamp (date. getTime (). toString ();