JSP Chinese Guest Book

Source: Internet
Author: User
Tags reset
js| Chinese <title>my the Guestbook</title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<body bgcolor= "#CCCCFF" vlink= "#000000" alink= "#666666" >

<div align= "center" >
<p><font size= "7" ><b><font size= "+6" >jsp guestbook</font></b></font> </p>
<form method= "POST" action= "index.jsp" >
<table width= "75%" align= "center" border=1>
<tr>
&LT;TD width= "30%" >
<div align= "right" >Name:</div>
</td>
&LT;TD width= "70%" >
<input type= "text" name= "name" >
</td>
</tr>
<tr>
&LT;TD width= "30%" >
<div align= "right" >E-mail:</div>
</td>
&LT;TD width= "70%" >
<input type= "text" name= "email" >
</td>
</tr>
<tr>
&LT;TD width= "30%" >
<div align= "right" >site url:</div>
</td>
&LT;TD width= "70%" >
<input type= "text" name= "url" value= "http://" >
</td>
</tr>
<tr>
&LT;TD width= "30%" >
<p>what Do you want to</p>
<p>say?</p>
</td>
&LT;TD width= "70%" >
<textarea name= "Body" rows= "5" cols= "></textarea>"
</td>
</tr>
<tr>
&LT;TD width= "30%" > </td>
&LT;TD width= "70%" > </td>
</tr>
<tr>
&LT;TD width= "30%" > </td>
&LT;TD width= "70%" >
<table width= "75%" >
<tr>
<td>
<input type= "Submit" name= "send" value= "send" >
</td>
<td>
<input type= "reset" name= "reset" value= "reset" >
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<%@ page contenttype= "text/html;charset=gb2312"%>
<%@ page language= "java" import= "java.sql.*"%>
<jsp:usebean id= "Sqlbean" scope= "page" class= "Jsp.sql_data"/>
<%! String Name,email,url,body,sql; %>
<%! int id; %>

<%
name = NULL;
Name = Request.getparameter ("name");
name = new String (request.getparameter ("name"). GetBytes ("8859_1"));
%>
<%= name%>
<%
if (name!= null&&name!= "")
{

name = new String (request.getparameter ("name"). GetBytes ("8859_1"));
email = new String (request.getparameter ("email"). GetBytes ("8859_1"));
url = new String (request.getparameter ("url"). GetBytes ("8859_1"));
BODY = new String (Request.getparameter ("Body"). GetBytes ("8859_1"));
ResultSet RSet = Sqlbean.executequery ("SELECT * from Guestbook");
Rset.last ();
id = rset.getrow () +1;
Rset.close ();
Sqlbean.sqlclose ();
sql = INSERT INTO guestbook (recordid,name,email,url,body) VALUES (' +id+ ', ' ' +name+ ', ' ' +email+ ' ', ' ' +url+ ', ' ", '" +body +"')";
Sqlbean.executequery (SQL);
Sqlbean.sqlclose ();

}else{
Out.print ("<b><font color=red> Please enter your name,email and body!!! </font></b> ");
}
%>
<p><font size= "4" ><b><a href= "./index.jsp#see" >see my guestbook</a></b></ Font></p>
<p> </p>
<%
ResultSet RS = Sqlbean.executequery ("SELECT * from Guestbook ORDER by RecordID DESC");

while (Rs.next ()) {
name = new String (rs.getstring ("Name"). GetBytes ("8859_1"));
email = new String (rs.getstring ("Email"). GetBytes ("8859_1"));
url = new String (rs.getstring ("Url"). GetBytes ("8859_1"));
BODY = new String (rs.getstring ("Body"). GetBytes ("8859_1"));
%>
<table border=1 width=80%>
<tr>
&LT;TD width=30%>name:</td><td width=70%><%= Name%>
</tr>
<tr>
&LT;TD width=30%>email:</td><td width=70%><a href= "mailto:<%= email%>" ><%= Email%> </a></td>
</tr>
<tr>
&LT;TD width=30%>siteurl:</td><td width=70%><a href= "<%= url%>" ><%= url%></a ></td>
</tr>
<tr>
&LT;TD width=30%>body:</td><td width=70%><%= Body%></td>
</tr>
</table>
<%
}
Rs.close ();
Sqlbean.sqlclose ();

%>


</div>
</body>


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.