<%
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>
<td width=30%>Name:</td><td width=70%><%= name %>
</tr>
<tr>
<td width=30%>Email:</td><td width=70%><a href="mailto:<%= email %>"><%= email %></a></td>
</tr>
<tr>
<td width=30%>SiteUrl:</td><td width=70%><a href="<%= url %>"><%= url %></a></td>
</tr>
<tr>
<td width=30%>Body:</td><td width=70%><%= body %></td>
</tr>
</table>
<hr>
<%
}
RS.close();
sqlbean.sqlclose();