我找不到错处?
<html>
<head>
</head>
<body>
<%@ page language="java" import="java.sql.*,sql_data;"%>
<%@ page contentType="text/html;charset=gb2312"%>
<jsp:useBean id="sqlbean" class="sql_data" scope="session" />
<%! String name,email,url,body,sql; %>
<%
name = request.getParameter("name");
email = request.getParameter("email");
url = request.getParameter("url");
body = request.getParameter("body");
if (name!=""&&email!=""&&body!="")
{
sql="insert into guestbook (name,email,url,body) values('"+name+"','"+email+"','"+url+"','"+body+"')";
sqlbean.executeInsert(sql);
}
else
{
out.print("<b><font color=red>Sorry,Please enter your name,email and body!!!</font></b>");
}
%>
<%
ResultSet RScount = sqlbean.executeQuery("SELECT * FROM guestbook");
int i=0;
while (RScount.next())
{
i++;
}
%>
<%-- <p><a name=see><B>Now,<%= RScount %> Records.</B></a></p> --%>
<p><B>现在有<%= i %> 条纪录</B></p>
<%
RScount.close();
i=0;
%>
<p> </p>
<%
ResultSet RS=sqlbean.executeQuery("SELECT * FROM guestbook");
while (RS.next())
{
name=RS.getString("name");
email=RS.getString("email");
url=RS.getString("url");
body=RS.getString("body");
%>
<table border=1 width=80%>
<tr>
<td width=30%>昵称:</td><td width=70%><%=name%>
</tr>
<tr>
<td width=30%>电子邮件:</td><td width=70%><a href="mailto:<%=email%>"><%=email%></a></td>
</tr>
<tr>
<td width=30%>个人主页地址:</td><td width=70%><a href="<%=url%>"><%=url%></a></td>
</tr>
<tr>
<td width=30%>内容:</td><td width=70%><%=body%></td>
</tr>
</table>
<hr>
<%
}
RS.close();
%>
</body>
</html>
<html>
<head>
</head>
<body>
<%@ page language="java" import="java.sql.*,sql_data;"%>
<%@ page contentType="text/html;charset=gb2312"%>
<jsp:useBean id="sqlbean" class="sql_data" scope="session" />
<%! String name,email,url,body,sql; %>
<%
name = request.getParameter("name");
email = request.getParameter("email");
url = request.getParameter("url");
body = request.getParameter("body");
if (name!=""&&email!=""&&body!="")
{
sql="insert into guestbook (name,email,url,body) values('"+name+"','"+email+"','"+url+"','"+body+"')";
sqlbean.executeInsert(sql);
}
else
{
out.print("<b><font color=red>Sorry,Please enter your name,email and body!!!</font></b>");
}
%>
<%
ResultSet RScount = sqlbean.executeQuery("SELECT * FROM guestbook");
int i=0;
while (RScount.next())
{
i++;
}
%>
<%-- <p><a name=see><B>Now,<%= RScount %> Records.</B></a></p> --%>
<p><B>现在有<%= i %> 条纪录</B></p>
<%
RScount.close();
i=0;
%>
<p> </p>
<%
ResultSet RS=sqlbean.executeQuery("SELECT * FROM guestbook");
while (RS.next())
{
name=RS.getString("name");
email=RS.getString("email");
url=RS.getString("url");
body=RS.getString("body");
%>
<table border=1 width=80%>
<tr>
<td width=30%>昵称:</td><td width=70%><%=name%>
</tr>
<tr>
<td width=30%>电子邮件:</td><td width=70%><a href="mailto:<%=email%>"><%=email%></a></td>
</tr>
<tr>
<td width=30%>个人主页地址:</td><td width=70%><a href="<%=url%>"><%=url%></a></td>
</tr>
<tr>
<td width=30%>内容:</td><td width=70%><%=body%></td>
</tr>
</table>
<hr>
<%
}
RS.close();
%>
</body>
</html>
解决方案 »
- Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
- jsp+花生壳网站发布问题
- javascript
- js和浏览器的问题 急用
- 一个字段插入不到数据库
- 大家来讨论阿,来者有分
- 偶得搜藏--是否开源?
- 大虾帮忙看看怎么解决??(maximum number of processes )
- 求助:TOMCAT如何正确设置servlet和javabeans的位置?
- 为什么只有一个Hello!?
- 点击form提交按钮后,是否可以先执行数据库更新,再调用一个java程序?
- Tomcat4.1.24的数据库连接池配置问题
sql_data是什么啊?
<%@ page language="java" import="java.sql.*"%>
remove ";"
<%@ page language="java" import="java.sql.*,sql_data"%>